I have a Google script that sends mails given some data in a Spreadsheet. The mail is sent with GmailApp using an alias set on Gmail settings. This alias is a PEC, the italian "certified mail account".
This is the function that sends the mail
var aliases = GmailApp.getAliases()
var fileXML = DriveApp.getFileById(xmlId);
var subject = fileXML.getName().slice(0, fileXML.getName().length - 4);
GmailApp.sendEmail
(
toMailPECAddress,
subject,
'',
{
// Send from alias (PEC account)
// Alias must be configured via GMail settings
'from': aliases[0],
'attachments': [fileXML]
}
);
This always worked. Since a couple of weeks ago, when I started getting a "service unavailable: gmail" error.
So far I did these test:
- re-generate the alias, to be sure that it is "verified"
- check that I can send mail from alias from Gmail web page; the receiver gets a mail that is correctly sent from the alias' SMTP
- send a mail via script with the exact same code but from my main Gmail account; no errors with that
- use MailApp instead of GmailApp in script; the mail is sent without errors, but it is NOT sent from the alias SMTP
What can be the problem?
Is there any new limitation that doesn't allow to send mails from aliases, or from non standard SMTP (from a PEC in my case)?