MailApp发送gmail帐户匿名帐户

时间:2014-02-27 00:20:21

标签: google-apps-script

我有一个脚本,可以向提交表单的人发送电子邮件给我。但是,我想发送一封来自匿名"的电子邮件。帐户,因此确认电子邮件不会来自我的帐户。有没有办法从其他帐户发送它,所以它看起来不像我手动生成所有这些电子邮件。谢谢!

我的脚本如下所示:

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

用户'是提交人的Google帐户和电子邮件'是提交者希望发送确认信息的电子邮件地址。

同样,有没有办法制作GmailApp.sendEmail(from:'Anonymous') ???

2 个答案:

答案 0 :(得分: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"});
}​

最重要的部分是最后一行{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: xyz@abc.com.  \n\n";
      MailApp.sendEmail(userEmail, subject, body, {name: 'SA Worksheet Helperbot', htmlBody: body, attachments: pdf}); 
      // Delete temp file
      DocsList.getFileById(copyId).setTrashed(true);
    }

如果你只是想让它看起来好像你整天都没有打电子邮件回复事情(我假设你的老板认为你正在做一些有用的事情),那么你可以添加别名到您的GmailApp方法并在电子邮件正文的底部添加免责声明行,如下所示:

    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: dummyEmail@xyz.com"    
    MailApp.sendEmail(userEmail, subject, body,{name: 'Form Helperbot',htmlBody: body, attachments: pdf});

答案 1 :(得分:0)

如果您只想因为不想收到回复而从匿名帐户发送,最好在电子邮件通知中指定虚拟回复地址。

  MailApp.sendEmail(userEmail, subject, body, {name: 'SA Worksheet Helperbot', htmlBody: body, attachments: pdf, replyTo: donotreply@example.com});