I want to send an email with Google Script, but I need to use the public (group) mailbox,
I didn't find an example of sending email from the group account on the Google API, and I couldn't find the answer on the stack overflow. Could you please tell me if there is a method that use google script send email with group account?
I have solved the problem. from "Account and import" add your group account then You can reference below code to test whether you can send an email in group account.
var alias = GmailApp.getAliases();
var num = alias.length-1;
var myMail = getMyMail();
if (num<0){
return false
}else{
for (var i = 0;i <= num;i++){
if (alias[i] == "[email protected]"){
var myGroupMail=alias[i];
break;
}
}
}
if (myGroupMail != "[email protected]"){return false}
GmailApp.sendEmail(toEmail,strSubject,strContent,{from : myGroupMail});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With