Reputation: 311
I am trying to generate Google Doc using script and then send it to email. Everything works fine when I'm giving my email as "from" parameter(I generate this doc with my Google account).
GmailApp.sendEmail
(
invoice.customerEmail,
'title',
invoice.emailBody,
{
attachments: [doc.getAs(MimeType.PDF)],
name: 'subject title',
htmlBody: invoice.emailBody,
from: '[email protected]'
}
);
Problem arises when I type in other email in 'from'. I published it as web app. Here are the settings :
Is there any way to fix it?
Upvotes: 0
Views: 311
Reputation: 6072
According to the GmailApp
documentation:
from
> the address that the email should be sent from, which must be one of the values returned bygetAliases()
Therefore, you can use the sendEmail
with other email addresses only if these email addresses are aliases of the email executing the script.
However, if you don't want to add this other email as your alias, you can simply create the script on this other account and execute it from there.
Upvotes: 1