Skip to content

Instantly share code, notes, and snippets.

@St3ph-fr
Created April 7, 2023 15:49
Show Gist options
  • Save St3ph-fr/fa12aff2d6a51582eabbd17392ff4cf5 to your computer and use it in GitHub Desktop.
Save St3ph-fr/fa12aff2d6a51582eabbd17392ff4cf5 to your computer and use it in GitHub Desktop.
/*
* Send a newsletter or any emails to multiple users easily, no need to use bcc
* If you are a workspace user with license > Business Standard you already have the multi-send
* https://support.google.com/google-workspace-individual/answer/11243118
*/
function sendMyNewsletter() {
let emails = 'COMA_SEPARATED_LIST_OF_EMAILS_NO_SPACE'
let subject = 'SUBJECT OF THE EMAILS IN YOUR DRAFT';
let draft = GmailApp.getDraftMessages().find(message => { return message.getSubject() == subject });
if(!draft){console.log('No draft found');return ;}
emails.split(',').forEach(email => {
GmailApp.sendEmail(email, draft.getSubject(), draft.getPlainBody(), {
"from": draft.getFrom(),
"htmlBody": draft.getBody() });
console.log('Email sent to : '+email); });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment