We are a non-profit Organisation that has been using Sheets, Forms and Apps Script, some of which send out emails using MailApp.sendEmail() from a standard Google account for a number of years with no problem.
We have now obtained a Google Workspace account with the intent to migrate our operational sheets/forms/scripts to the new Workspace as Google Workspace has much higher account limits. One of the first things we have tried, is to test out the script mailing functionality and it simply does not work from any of our Google Workspace accounts. Note general user emails are working fine from within our workspace account as we have sent many from various internal accounts i.e. our general email set-up is functional.
Below is a simple code block that we used to test. In order to provide more information, the script tries to send a test email to four separate email accounts – two external mail accounts using different destination mail servers and two google accounts, one internal to the workspace domain and one external (@gmail.com). The script executes fine, the email appears in the sent folder of the sending account (the one running the script), but nothing arrives at any of the destinations. The code is shown below (with email addresses changed for security):
function testEmail() {
Logger.log('testEmail START');
var address = '[email protected],[email protected],[email protected],[email protected]';
// Create the html version of the response email
var html_mailBody = 'Hello this is a test email<br><br>';
// Create the text version of the response email
var text_mailBody = 'Hello this is a test emailnn';
// Send the email
MailApp.sendEmail({
to: address,
subject: "Test Email to three different recipients",
body: text_mailBody,
htmlBody: html_mailBody
});
Logger.log('testEmail END');
}
In trying to investigate further, we looked at the email logs in our Google Workspace Admin Console and what we see is the the email is listed as “bounced” for each of the recipient addresses and “delivered to Gmail mailbox” for the sender i.e. placed in the Sent folder. Upon expanding the logs for the bounced mails all we see are “delivered to an SMTP server” immediately followed by “bounced”. There are no details of server addresses and as no actual bounce message is received, we have no email headers to look at for bounced messages.
We have looked on the web and have found a few references to this type of behaviour but the only “answer” seems to be “use GmailApp instead” which we’re sure will work but we’d expect to see more “noise” if MailApp didn’t work from a Google Workspace account so we suspect that we may have something set wrong in our Workspace Domain and we would prefer not to have to adjust our scripts when migrating.
We have reached out to Workspace support but we are going around in circles so thought we would see if anybody else has seen this or as a minimum, get confirmation that MailApp does currently work from A Google Workspace account.
Paul Rousell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.