Search code examples
emailgmailamazon-seszoho

What is the standard way to get a list of bounced emails to remove it from mailing list through API or otherwise


I am running a marketing campaign through Amazon SES and other few services. The email providers are zoho and gmail.

What I need to know is how can i get a list of emails which have bounced and remove it from mailing list to keep the list cleaned. Now I need to do it on a daily basis. Does gmail or zoho give provides a way to get a list through api or any other way? AFAIK SES does not provide an api to get a list directly of the bounced emails. Does gmail or zoho provide an api?

I think, it can be collected through scraping the inbox. Doing it manually is not a feasible option.

What I am missing. What is the standard way to handle this problem?


Solution

  • What you need is scrape your inboxes to get all bounced emails by subject.

    Read about IMAP. Also, check out imaplib package and email package python.

    https://docs.python.org/3/library/imaplib.html

    https://docs.python.org/3/library/email-examples.html

    This blog can be really helpful:

    https://yuji.wordpress.com/2011/06/22/python-imaplib-imap-example-with-gmail/