title | page_type | urlFragment | products | languages | extensions | description | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Report spam or phishing emails in Outlook (preview) |
sample |
outlook-spam-reporting |
|
|
|
Learn how to create an integrated spam-reporting add-in in Outlook. |
Applies to: Outlook on Windows
This sample showcases how to build an integrated spam-reporting solution that:
- Is easily discoverable in the Outlook client ribbon.
- Provides the user with a processing dialog to report an email.
- Facilitates saving a copy of the reported email to a file to submit it to your backend system for further processing.
To learn about key components of this sample, see Implement an integrated spam-reporting add-in (preview).
Important
The integrated spam-reporting feature is currently in preview in Outlook on Windows. Features in preview shouldn't be used in production add-ins. We invite you to try out this feature in test or development environments and welcome feedback on your experience through GitHub.
Outlook on Windows starting in Version 2307 (Build 16626.10000).
Note
If you don't have a Microsoft 365 subscription, you might qualify for a free developer subscription that's renewable for 90 days and comes configured with sample data. For details, see the Microsoft 365 Developer Program FAQ.
- Microsoft 365 subscription
- You must join the Microsoft 365 Insider program and select the Beta Channel option to access Office beta builds.
Tip
If you're unable to choose a channel in your Outlook client, see Let users choose which Microsoft 365 Insider channel to install on Windows devices.
Important
To test the getAsFileAsync
method while it's still in preview in Outlook on Windows, you must configure your computer's registry.
Outlook on Windows includes a local copy of the production and beta versions of Office.js instead of loading from the content delivery network (CDN). By default, the local production copy of the API is referenced. To reference the local beta copy of the API, you must configure your computer's registry as follows:
Run this sample in Outlook on Windows using one of the following add-in file hosting options.
- Download the manifest.xml file from this sample to a folder on your computer.
- Sideload the add-in manifest in Outlook on Windows by following the manual instructions in Sideload Outlook add-ins for testing.
- Follow the steps in Try it out to test the sample.
If you prefer to host the web server for the sample on your computer, follow these steps.
-
Install a recent version of npm and Node.js on your computer. To verify if you've already installed these tools, run the commands
node -v
andnpm -v
in your terminal. -
You need http-server to run the local web server. If you haven't installed this yet, run the following command.
npm install --global http-server
-
You need Office-Addin-dev-certs to generate self-signed certificates to run the local web server. If you haven't installed this yet, you can do this with the following command.
npm install --global office-addin-dev-certs
-
Clone or download this sample to a folder on your computer, then go to that folder in a console or terminal window.
-
Run the following command to generate a self-signed certificate to use for the web server.
npx office-addin-dev-certs install
This command will display the folder location where it generated the certificate files.
-
Go to the folder location where the certificate files were generated, then copy the localhost.crt and localhost.key files to the cloned or downloaded sample folder.
-
Run the following command.
http-server -S -C localhost.crt -K localhost.key --cors . -p 3000
The http-server will run and host the current folder's files on localhost:3000.
-
Now that your localhost web server is running, you can sideload the manifest-localhost.xml file provided in the sample folder. To sideload the manifest, follow the manual instructions in Sideload Outlook add-ins for testing.
-
Follow the steps in Try it out to test the sample.
Once the add-in is loaded in Outlook, use the following steps to try out its functionality.
-
Choose a message from your inbox, then select the add-in's button from the ribbon.
-
In the preprocessing dialog, choose a reason for reporting the message and add information about the message, if configured. Then, select Report.
-
(Optional) In the post-processing dialog, select OK.
- Implement an integrated spam-reporting add-in
- ReportPhishingCommandSurface Extension Point
- Office.MessageRead.getAsFileAsync() method
- Troubleshoot event-based and spam-reporting add-ins
- Debug your event-based or spam-reporting Outlook add-in
- Microsoft Office Add-in Debugger Extension for Visual Studio Code
- Develop Office Add-ins with Visual Studio Code
- Office Add-ins with Visual Studio Code
- Debugging with Visual Studio Code
- Node.js debugging in VS Code
- Office-Addin-Debugging
- Did you experience any problems with the sample? Create an issue and we'll help you out.
- We'd love to get your feedback about this sample. Go to our Office samples survey to give feedback and suggest improvements.
- For general questions about developing Office Add-ins, go to Microsoft Q&A using the office-js-dev tag.
Copyright (c) 2024 Microsoft Corporation. All rights reserved.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Solution | Author(s) |
---|---|
Report spam or phishing emails in Outlook (preview) | Eric Legault |
Version | Date | Comments |
---|---|---|
1.0 | March 26, 2024 | Initial release |