Reputation: 181
I'm following the Google Scripts tutorials on how to send emails from a google sheet.
The code works fine and I do receive an email when I run it. However, when I check my inbox, instead of the header showing my name in the preview, it shows the full email address.
Here's the code from the tutorial:
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 2; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 2)
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (i in data) {
var row = data[i];
var emailAddress = row[0]; // First column
var message = row[1]; // Second column
var subject = "Sending emails from a Spreadsheet";
MailApp.sendEmail(emailAddress, subject, message);
}
}
Is there any way I can set it to be my name instead of it being my full email address?
Upvotes: 1
Views: 2682
Reputation: 201643
How about following modification for your script?
MailApp.sendEmail(emailAddress, subject, message);
MailApp.sendEmail(emailAddress, subject, message, {name: '### Your name ###'});
If this was not helpful for you, I'm sorry.
Upvotes: 4