Search code examples
gmailgmail-apispam-prevention

Add a safe sender using the Gmail API?


Is it possible to add an address or domain to the safe senders list using the Gmail API? Not for malicious reasons, of course 😉


Solution

  • Gmail does not have a "safe sender list", per se.

    BUT, two ways that you can achieve some of the same effect are: (a) adding the email address to contacts, and/or (b) adding a filter for that email address (or domain) that makes the message always go to the inbox.

    For adding contacts via an API, see the people.createContact method on the people API: https://developers.google.com/people/api/rest/v1/people/createContact

    For adding filters via an API, see "managing filters" for the Gmail API: https://developers.google.com/gmail/api/guides/filter_settings