简体   繁体   中英

Detecting bounced email in a gmail integration

We want to provide a Gmail integration to help users find out all bounced emails. What will be the best way to do it? A user sent an email to xxxx@thiswillbounce.com and then got back a bounced email from the email server. From the gmail API, we can see bunch of headers from the bounced email. Can we use these headers to detect this is a bounced email programmatically?

Bounced email's headers:

{ "name": "Subject", "value": "Undeliverable: Test Mail" }, { "name": "From", "value": "Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@outlook.com>" } ...

You can use Gmail Search to detected bounced emails and they mostly have mailer-daemon as the sender.

from:(mailer-daemon@google.com OR mailer-daemon@googlemail.com)

You can then parse the plain text part of the raw message to detect the original recipient where the message was sent to.

I also wrote a tutorial on detecting bounced emails in Gmail with Google Scripts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM