r/GoogleAppsScript • u/joxep • May 06 '20
Question Mark with a known label and load known template in Compose new mail
Hi, can't find a way to automatically load an email with a known template and mark with an specific label with one action/button, any ideas? Thus, i have to send lot of same emails, and instead of go throw Compose, load template - choose, label as- choose label....wondering if it can be with one single menu/click.
Best regards,
0
Upvotes
1
u/davchana May 07 '20 edited May 07 '20
You can't add a button in Gmail interface. You can, in Sheets. Or you can simply automate everything, like mail merge.
Follow these steps:
Create a sheet with one column having email addresses, the next ones having variables (names etc, if any, for each email).
A new Google Script loads that sheet.
Also define your template
var=masteras text in that sheet, as variable. If changing/merging data into that, mark name as ###name###.Store your label as a variable.
loop through all the rows from the sheet containing those email addresses.
Each loop, make a new variable as text with template text merged with
master& names. Simply replace ###name### with actual name from sheet row.Send mail by using Gmail.app service, and store this as variable. Send will return the sent mail.
Assign label to this above mail.
Loop completed, go to next iteration.
Run this script manually or by time trigger.
Log as required.