可以在GmailApp Sendemail中使用来自地址的更改:现在必须“视为别名”吗?

时间:2016-11-03 16:31:59

标签: google-apps-script

我有我授权的脚本,可以从我的一个发送电子邮件地址发送电子邮件;但是,该特定地址过去未被检查为“视为别名”(设置>帐户>发送邮件为>编辑信息>取消选中“视为别名”)。在过去几周中,使用此方法的脚本失败,出现错误“执行失败:无效参数:nontreatasaliassendasaccount @____。edu。

我无法找到此更改的文档。这是from参数将如何发挥作用吗?

//---abbreviated script (last line throws error)---
function sendFormByEmail(e) {  
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var message =""; 
var columns = sheet.getRange(1,1,1,lastColumn).getValues()[0];

//collate form questions/answers to send in email  
for (var keys in columns) 
var questionName = columns[keys];
//creates list of all questions and answers 
if (e.namedValues[questionName] && (e.namedValues[questionName] != "") ){
message += "<b>" + questionName + "<\/b>" + ": "+
e.namedValues[questionName] + "<br>"; 
}
}

//send mail to requestor with form questions/emails
//(sent from a non-primary send-as email address 
//that is NOT marked as an alias in Settings > Accounts > Send Mail As)
GmailApp.sendEmail("recipient@___.edu", "Thanks for your request", "",
{htmlBody: message, from:"nontreatasaliassendasaccount@_____.edu"});

1 个答案:

答案 0 :(得分:1)

在不改变任何内容的情况下,我再次能够使用GmailApp.sendEmail发送电子邮件并将从电子邮件地址指定为非别名的辅助发送帐户:

所有突然再次作品

GmailApp.sendEmail("recipient@___.edu", "Thanks for your request", "",
{htmlBody: message, from:"not_treat_as_alias_send_as_account@_____.edu"});

也有效

(并且在上述期间没有做过)

GmailApp.sendEmail("recipient@___.edu", "Thanks for your request", "",
{htmlBody: message, from:"alias_send_as_account@_____.edu"});

我从未找到有关功能变化的文档。