Can you change the from email in google mail merge
In Google Sheets, you can change the "From" email address in a Mail Merge using the setFrom
method. Here's an example:
Assuming you have a sheet named "Mailing List" with a column named "Email" and a column named "Name", and you want to send an email to each person in the list using a Mail Merge:
- Go to the "Tools" menu in Google Sheets and select "Mail Merge".
- In the Mail Merge window, select the sheet and range you want to use for the merge.
- In the "From" field, enter the email address you want to use as the sender. You can also use a formula to dynamically generate the email address, such as
=A2
if the email address is in column A. - Click "Merge" to send the emails.
Alternatively, you can also use the setFrom
method in the Mail Merge script editor. To do this:
- Go to the "Tools" menu in Google Sheets and select "Script editor".
- In the script editor, click on the "Mail Merge" tab.
- In the "Mail Merge" tab, click on the "Set from" button.
- In the "Set from" dialog box, enter the email address you want to use as the sender.
- Click "OK" to save the changes.
Here's an example of how you can use the setFrom
method in your script:
function mailMerge() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A1:B10"); // Assuming the email addresses are in column A
var fromEmail = "[email protected]"; // Replace with the email address you want to use as the sender
MailApp.setFrom(fromEmail);
MailApp.sendEmails(range, "Subject", "Body");
}
Note that you need to replace [email protected]
with the actual email address you want to use as the sender.