[英]Sender's name in google scripts
I'm following the Google Scripts tutorials on how to send emails from a google sheet.我正在关注有关如何从 Google 表格发送电子邮件的 Google Scripts 教程。
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?有什么办法可以将它设置为我的名字而不是我的完整电子邮件地址吗?
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.如果这对您没有帮助,我很抱歉。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.