Reputation: 55
I have tested a Google Apps script to send a google doc converted to PDF by mail automatically. The email is sent to one email address at a time. I tested this with my normal Gmail account and it worked fine. But when I try to use it on my Gsuite account (professional mail), I get a "delivery failure" mail with this error inside it :
Message blocked
Message rejected. See https://support.google.com/mail/answer/69585 for more information.
After calling the google assistance, I activated the "allow unsafe application access". It's been 4 hours now since I've activated this option (the option says that it might take some time to get into effect), but the error is still there.
Do you know why such an error may be generated ? The link provided in the delivery failure mail does not provide precise information about this mail, apart from general indications like maybe it's "spam", "the recipient does not exist", etc...
Such indications does not qualify with this mail because the fact is that I know it's usually working on my Gmail account. I don't know why it's blocked with the Gsuite account.
EDIT : When I send the same mail manually with the Gsuite account, with the same title, body and attachment, the mail goes through without any issue.
I have to point that I did not shared documents/sheets or the script between the two accounts (because it has generated weird script behavior in the past). I copy-pasted the documents and the scripts in my new Gsuite account. My Gsuite account is the only owner and has the only access to the documents and the script, without any sharing.
Here is the portion of the script used to send the automated email :
//recipientmail is defined elsewhere
//newPDFReportId is defined elsewhere
if (recipientmail !== null) {
MailApp.sendEmail(
recipientmail,
"EMAIL OBJECT",
"Hi !\r\rThis is an example of an automated mail.\r\r\rDon't hesitate to get in touch.\rThis is the alpha version of the email sender.",
{attachments: DriveApp.getFileById(newPDFReportId)})
}
Upvotes: 2
Views: 265
Reputation: 55
I solved the delivery failure of the automated mail by using GmailApp instead of MailApp in my script.
Upvotes: 1