I’m sending mail to a third party-service from Gmail using Google Apps Script. This third party requires the sender email address be registered with them. If the sender is not registered, an error/marketing message is sent back to the original sender.
When the message is sent from Gmail manually, it is processed as expected by the third party. When the message is sent by a script, the message is not processed by the third party and no error response is sent as described above. After adding a different gmail address as a BCC on one such message, I found the script generated message shows “mailed-by: bounce.secureserver.net” and “signed-by: gmail.com”
I’m worried GAS is impersonating the sender in such a way that the third party does not recognize the sender as a registered address. Or, the third party may be dropping the messages as spam. (http://productforums.google.com/d/topic/apps-script/tGxlioK1ejg/discussion)
Community feedback on this problem is most appreciated.
According to Google’s documentation, the sendEmail() method sends an email as the user running the script. That being said, additional parameters are automatically added to the email’s header, and these might trigger some filtering rules on the recipient side. There is not much you can do about that, beside using a third-party email service like SendGrid which might do a better job at ensuring that your email will go through.