Search code examples
gmailgmail-api

How to report a message as spam from the Gmail API?


It is possible in the GMail UI to report an email as spam. I have not found this feature in the Gmail API documentation. What would be the proper way to do it? Does adding the SPAM label to the email have the same effect?

Report as spam


Solution

  • Answering your question, yes, when you add the label SPAM to an email using the Gmail API will have the same effect as marking the email as Spam in the web UI since based on the Google Documentation:

    Tip: When you click Report spam warning or manually move an email into your Spam folder, Google will receive a copy of the email and may analyze it to help protect our users from spam and abuse.

    Remember that the folders in Gmail are basically labels, based on the information in this documentation.

    So when you mark an email as SPAM in the web UI, you are essentially adding the label SPAM to the email, the same as with the Gmail API.

    Reference: