2014-02-27 119 views
0

我有一个脚本发送电子邮件给提交表单给我的人。但是,我想从“匿名”帐户发送电子邮件,所以确认电子邮件不会从我的帐户中获得。有没有办法从不同的帐户发送它,所以它看起来不像我手动生成所有这些电子邮件。谢谢!MailApp发送Gmail帐户匿名帐户

我的脚本是类似以下内容:

if (user = email) { 
    GmailApp.sendEmail(user, subject, message); 
    } 

其中“用户”是谷歌帐户提交人,“电子邮件”的是电子邮件地址提交意愿的人都发送到确认。

再次,有没有办法使GmailApp.sendEmail(from:'Anonymous') ???

回答

0

嗯,我不能完全回答它可以是匿名的。您可以使用“虚拟”帐户创作该应用程序以遮盖您的电子邮件地址,但是如果您使用的是商业或教育帐户,那么该帐户实际上并不奏效。此外,您可以通过给电子邮件发送一个“别名”名称来吸引注意力分散收件人的注意力。

MailApp.sendEmail(userEmail, 
    "Help Desk Ticket", 
    "Thanks for submitting your issue. \n\nWe'll start " + 
    "working on it as soon as possible. \n\nHelp Desk", 
    {name:"Help Desk"}); 
}​ 

这方面最重要的部分是最后一行{名称的元素:“帮助台},这使得您的电子邮件‘名’帮助台,但你仍然可以看到发送的电子邮件地址,如果你的鼠标。在它(这就是为什么我建议在开始一个“虚拟”的电子邮件地址)

你可以看到脚本的情况下在本教程:https://developers.google.com/apps-script/articles/helpdesk_tutorial

下面是我如何使用相同的一个例子剧本中的东西:

function mailCheatSheet(copyId,userEmail,mrNumber){ 
     var copyId = copyId; 
     var userEmail = userEmail; 
     var mrNum = mrNumber; 
     // Convert temporary document to PDF by using the getAs blob conversion 
     var pdf = DocsList.getFileById(copyId).getAs("application/pdf"); 
     // Attach PDF and send the email 
     var subject = "SA Funding request by: "+userEmail; 
     var body = userEmail +" has submitted a SA Funding Inquiry for " +mrNumber +", which is attached to this email. \n" 
      +"Please ensure there are no errors before printing. \n" 
      +"If there are errors, please notify: [email protected] \n\n"; 
     MailApp.sendEmail(userEmail, subject, body, {name: 'SA Worksheet Helperbot', htmlBody: body, attachments: pdf}); 
     // Delete temp file 
     DocsList.getFileById(copyId).setTrashed(true); 
    } 

如果你只是想让它看起来像你没有整天坐在电子邮件回应中(我假设你的老板认为你正在做一些有用的事情),那么你可以添加别名

var body = userEmail +" has submitted a SA Funding Inquiry for " +mrNumber +", which is attached to this email. \n" 
     +"Please ensure there are no errors before printing." 
     +"\n\nThis email was automatically authored by Form Helperbot. If there is an error, please report it to: [email protected]"  
    MailApp.sendEmail(userEmail, subject, body,{name: 'Form Helperbot',htmlBody: body, attachments: pdf}); 
0

如果你想从一个匿名帐户发送只是因为你不想收到的答复,这可能是:你的GmailApp方法,并在电子邮件正文中的这样的底部添加一个声明行在电子邮件通知中指定一个虚拟回复地址是一个更好的主意。

MailApp.sendEmail(userEmail, subject, body, {name: 'SA Worksheet Helperbot', htmlBody: body, attachments: pdf, replyTo: [email protected]});