Sometimes emails sent from any account bounce back for various reasons. The primary reason for this is the wrong email address, which could be due to:
- A character in the email address is wrong or missing
- The email address does not exist at all.
When emails are sent using Gmail and the mail bounces, the bounce-back notification comes from Mail Delivery Subsystem< email@example.com >. This notification contains the details such as :
- Reason code of failure, known as SMTP error code. As examples, an error code 550 is for the reason that the email address doesn’t exist and 554 is for your email being classified as spam by the addressee.
- Short description of the failure which reads like “Address not found”
For individuals, such emails can be manually tracked without much effort as there will not be many such cases. But when mass mailers are sent for any marketing campaign or any other reason, it becomes essential to track all such bounced emails and doing that manually is painful and time-consuming. This can be automatically done either by using the mail merge add on the tool available in Gmail or by using a script. There are various open-source scripts available for the same; one such script is available in Google itself.
Let us discuss how both the above options are used.
- Mail Merge: Mail Merge for Gmail automatically scans the email account and processes all the bounced email messages. It parses the text of the bounced emails and prepares a report detailing the reasons why the messages have bounced and the time at which it occurred.
To use the Mail Merge functionalities the following steps have to be followed:
Go to Add-ons > Mail Merge > Campaign Reports > View Bounced Email to prepare your bounce report.
The report will be for the Google account and contains it. The following is a sample of how the report looks:
The above feature of Mail Merge usually does not come with the free Gmail account and will be a premium paid service.
- Using an Open Source Google Script:
Followings are the steps to run the script and get the report:
- Make a copy of the Google Spreadsheet.
- Open the Bounced Emails menu in Google Sheet and then select the Run Report option.
- Authorize the Google Script so it can scan your Gmail account for bounced emails and write them to the Google Sheet.
- Watch as the Google Sheet is populated with rejected and bounced email addresses.
Like the Mail Merge option, the email bounce report includes the email address that bounced, the reason why that email failed to deliver and the date when the bounce occurred. The spreadsheet also has a link to the bounced message.
Inside the Google Sheet, one can go to the Tools menu and choose Script Editor to view the full source code of the Google Script. This code can be reused or modified