简体   繁体   中英

“Invalid argument: : Invalid to header” error in Google scripts using GmailApp.sendEmail

I keep getting "Invalid argument: : Invalid to header" on the following line in my google scripts code:

GmailApp.sendEmail(emailAddress, subject, message, {from: 'first.last@gmail.com',cc: 'michelle@gmail.com,barack@gmail.com', htmlBody: message});

I am sending emails based on info from a google sheets doc. What does this error mean, and how can I resolve it?

There is no "from:" advanced parameter in the documentation. You cannot send a mail on behalf of someone else. This script will need to be run from their account if you want to the mail sent from them.

https://developers.google.com/apps-script/reference/mail/mail-app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM