I have created a number of tools that use Installable Triggers to send emails. Because I'm the one who wrote the scripts, and created the triggers, those emails are all sent from my account.
I am wondering if there is a way to create those installable triggers, not as my own account, but as a Google Group account. Ideally, I would like for those triggered emails to be sent from the Group's account, as opposed to my own. I am an Owner of the Google Group that I would like to use, so if it's possible, I should have the appropriate security. I'm just not sure if there's a way to log in as the Group, so that I can create the triggers from the Group's account, and therefore have the emails sent from the Group's account. Is that possible?
You don't need to sign in your group in the script, you just need to add the group email to your gmail settings Send mail as:
After adding it, a window will prompt you and add your group credentials there. After confirmation, you should be able to use that email as your parameter for sendEmail
. See code below.
function sendEmailUsingGroupEmail() {
var alias = GmailApp.getAliases();
var groupEmail = "group@domain.com";
var toEmail = "test@domain.com";
var strSubject = "subject";
var strContent = "this is content";
// Check first if that email exists after adding
if(alias.includes(groupEmail))
GmailApp.sendEmail(toEmail,strSubject,strContent,{from: groupEmail});
}