title | page_type | urlFragment | products | languages | extensions | description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Report spam or phishing emails in Outlook |
sample |
outlook-spam-reporting |
|
|
|
Learn how to create an integrated spam-reporting add-in in Outlook. |
Applies to: Outlook on the web, Outlook on Windows (new and classic)
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.
- Outlook on the web
- new Outlook on Windows
- classic Outlook on Windows starting in Version 2307 (Build 16626.10000)
A Microsoft 365 subscription.
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.
Run this sample in Outlook on Windows (new or classic) or on the web 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 (new or classic) or on the web 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. The images in the following steps show how the spam-reporting add-in and its dialogs appear in classic Outlook on Windows. Note that the appearance may vary depending on your Outlook client.
-
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.
-
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 | Eric Legault |
Version | Date | Comments |
---|---|---|
1.0 | March 26, 2024 | Initial release |
1.1 | July 1, 2024 | Create separate JavaScript files for supported clients |