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("myemail@gmail.com",emailSubject,"", {htmlBody: body, cc: "anotheremail@gmail.com, thirdemail@gmail.com"});

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: <000000000000eb73c1057a773c96@google.com>

Final-Recipient: rfc822; myemail@gmail.com
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)

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.

How to resolve “Message Blocked. Your message to [receiver] has , Learn how to resolve the Message Blocked issue affecting new G-Suite users when trying to Duration: 5:14 Posted: Nov 10, 2018 This errors would generally bounce back your sent email, however, continuously sending this mailer to these unavailable mail address could possibly result to message rejection and blocking. The other factors that are also being considered are to avoid spammers and the Google started blocking those emails as well.

I do not have a clear answer in here; I just want to be able to converse with devs in the same tough spot between a Google algo and a client having his business interrupted.

@amit: First that link you sent does not cover the actual situation. Second I ran my code for a second time manually and it processed everything perfectly so the content is not the sole trigger for this rejection.

To elaborate: I made a survey tool for a client (with google biz account) that inputs the results in a google sheet with multiple tabs that receive rows of data. Once a day each tab generates a "day summary" of those results and sends it in an email.

It has 1 TO and 2 BCC targets. The body of the text contains multiple email addresses as clickable links. This worked fine till a few weeks ago.

Now today, without changing anything, the emails were sent out with no bounce/rejections. My conclusion is that it is indeed Google's preventive anti-spam filters doing. Just not as simple as "containing links".

Perhaps it's the time? As I see your email, and mine are sent at 3/4 AM, correct? Perhaps it has to do with the CC/BCC emails never being opened? As my BCC targets are both my client's own email addresses (in gmail).

It really sucks that there is no actionable info from Google on this error.

Google blocked my account. Why and what should I do , Learn how to resolve the Message Blocked issue affecting new G-Suite users when trying to Duration: 5:14 Posted: Nov 4, 2018 2. Too Many Invalid Email Addresses. Repeatedly sending messages to invalid email addresses defines you as a spammer and leads to email deliverability challenges. Take care about your email list hygiene and follow these simple rules: Use confirmed subscription method. Single opt-in is good but double opt-in is better.

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!

Limits for sending & getting mail - Gmail Help, sendEmail(). Scripts work fine on other accounts. Delivery Status Notification (​Failure). Message blocked. The response was: Message rejected. You may want to mark a cell in each row every time an email is sent. This way, if your script stops running (for instance, if there is a bug in your code or you reach the maximum number of emails you can send every minute or day) you will be able to re-run the script later on and avoid sending email duplicates.

Resolved - Message Blocked Gmail Google Apps Script, Hi everyone! I created a new gmail account yesterday and I try to send email from spreadsheet with this account. I use google script to do it  If you're sure the file is safe, you can ask the sender to upload the file to Google Drive. Then send it as a Drive attachment. Sometimes messages are blocked when you don't include any

Resolved, Google Apps Script Examples Message bounced / not sent due to sending limit 1 Why have my emails not been sent out? 2 Why did Google block my Gmail / Google Apps account? 3 How to avoid your account to be blocked again? Sends email. This service allows users to send emails with complete control over the content of the email. Unlike GmailApp, MailApp's sole purpose is sending email. MailApp cannot access a user's Gmail inbox. Changes to scripts written using GmailApp are more likely to trigger a re-authorization request from a user than MailApp scripts.

Gmail doesn't send emails generated by Script using MailApp , That means, the Google mail itself aborted the message sending actions to avoid uncertain situations. Why G Suite / Gmail Message Blocked? I'  Basically, with a Google Apps script, you can send out customized messages to several people with a single click and also customize the content per user if need be. In the next 10 minutes, you will see how your life will become very easy by sending out a large number of emails using Google App script.

Comments
  • Is the form embedded in html? That maybe the reason. Also Try GmailApp instead
  • I did research before posting this and saw that BUT there are no links in the email body just HTML. Also remember that I can send it to myself as the TO just fine, its as soon as I add one CC
  • Hi Johnny. Please do not add voting advice in posts. Not only is it distracting for the wider part of the readership, who do not have accounts to sign into, but it can paradoxically encourage more downvoters. (This post would not have fitted into a comment anyway).
  • Thank you, it worked for me. Though GmailApp API is a bit different from MailApp’s one.