Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Message blocked when sending email from Google Script

I have a survey form that people submit the hours they work and it sends their response in an email to me and then CC's two other people. The script was authorized by me to send the emails and has worked fine for a long time until a couple days ago when now I am getting a reply back from all three emails saying Message blocked. Any idea why these are being blocked?

MailApp.sendEmail("[email protected]",emailSubject,"", {htmlBody: body, cc: "[email protected], [email protected]"});

If I only send the email to myself then it works perfectly fine. If I include even one CC email address I get the block.

Reporting-MTA: dns; googlemail.com
Arrival-Date: Mon, 12 Nov 2018 04:57:05 -0800 (PST)
X-Original-Message-ID: <[email protected]>

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.0.0
Diagnostic-Code: smtp; Message rejected.  See https://support.google.com/mail/answer/69585 for more information.
Last-Attempt-Date: Mon, 12 Nov 2018 04:57:05 -0800 (PST)
like image 323
Brad Wickwire Avatar asked Mar 18 '26 19:03

Brad Wickwire


2 Answers

Using GmailApp.sendEmail(emailAddress, subject, message) solves this.

This seems to be an issue with all new GSuite accounts as discussed here: MailApp.sendEmail() in Google Apps Script not sending email

It is particularly frustrating that Google has no response to this huge shortcoming for over 4 months!

like image 171
MonkSafari Avatar answered Mar 21 '26 09:03

MonkSafari


This likely happens when Google algorithms find any suspicious link in the body of your email. You can consider removing any links from the email and try sending the message again to confirm the issue.

The Google support site has more information.

like image 35
Amit Agarwal Avatar answered Mar 21 '26 08:03

Amit Agarwal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!