Skip to content Skip to sidebar Skip to footer

Problem In Sending Email By Google Apps Script

I have been sending Email by Google Apps Script successfully for sometimes. However, when I open a new Google Workspace account and use the same code to send the same things to the

Solution 1:

TL;DR:

Gmail thinks you are a spammer. Changing MailApp for GmailApp should work. In your case:

GmailApp.sendEmail("xxx@gmail.com","From yyy","Hello!");

Full answer:

The reason this is happening is because Gmail is flagging your email as a possible spam. This is likely because it is a new account, the contents of the message and configuration (like sending only plain text, no replyTo or noReply configuration, etc.). The Google algorithm is probably quite complex and there is no clear way of testing it. Here is an article talking about how to prevent being blocked.

Other people that had this problem seem to have success using GmailApp instead of MailApp (Stack Overflow question 1, Stack OVerflow question 2). The reason is probably how the services internally work.

Post a Comment for "Problem In Sending Email By Google Apps Script"