如何将Google脚本发件人电子邮件发送到no-reply@entreprise.com?

4
我通过附加的Google脚本,向一个学生社区发送了200封电子邮件。
我的邮件调用如下:
MailApp.sendEmail(
  "toto@gmail.com",             // targetEmail
  "HELLO FROM KING OF NIGERIA", // emailTitle
  "",                           // something
  // emailContentHTML
  { htmlBody:  "<b>Hello John</b><br><p>I'am king of Nigeria.<br>Got gold everywhere.<br>Need your help I'am in danger.<br>Want to share with you.<br>Could you send me 50$<br>Sinceraly, your friend.</p>"}
);

由我所使用的 Google 账户 john.Doe@entreprise.com 运行的脚本使 200 多名参与者看到的邮件似乎是来自我 (john.Doe@entreprise.com)。我知道这样做可以有效地减少垃圾邮件等,但是因为我们公司使用的是 Gmail 域名 entreprise.com,我不想在接下来的日子里收到数十封无用的“谢谢你”的提醒邮件。当然,我绝不希望他们把我留在他们后续的讨论中。

因此,我正在寻找如何创建一个 no-reply@entreprise.com 账户,并使用 JavaScript 使脚本使用这个 no-reply@entreprise.com 邮箱签署邮件的解决方案。

另外,有没有办法以编程方式从我们公司的其他账户 (no-reply@entreprise.com) 签署 Google Script 邮件?

注意:Google Script 手册

3个回答

3

由于脚本是在您的Gmail帐户下运行,最简单的方法是将noReply:true添加到消息对象中。这将导致电子邮件从一个通用的noreply@enterprise.com电子邮件地址发送。此noreply电子邮件账户不需要为此而创建。

请注意,这对个人Gmail帐户不起作用。

Edward Wall的答案中提到,有关此内容的文档位于此链接

MailApp.sendEmail(
  "toto@gmail.com",             // targetEmail
  "HELLO FROM KING OF NIGERIA", // emailTitle
  "",                           // something
  // emailContentHTML
  { htmlBody:  "<b>Hello John</b><br><p>I'am king of Nigeria.<br>Got gold everywhere.<br>Need your help I'am in danger.<br>Want to share with you.<br>Could you send me 50$<br>Sinceraly, your friend.</p>", 
  //send from generic noReply@enterprise.com address
  noReply: true}
);


0
您可以使用MailApp文档中的以下方法。
sendEmail (title, replyTo, subject, body)

replyTo设置为您的“不回复”电子邮件将意味着任何按下回复按钮的人都会将他们的电子邮件发送到您的“不回复”邮箱。

MailApp.sendEmail (
  "email@example.com",        // targetEmail
  "do-not-reply@example.com", // reply to email
  ...
)

MailApp文档链接


0

从 no-reply@enterprise.com 账户发送电子邮件的最简单方法是使用 Apps 脚本在该账户权限下运行。

如何实现这取决于脚本的执行方式。如果是通过触发器执行,触发器必须由 no-reply 账户创建。

如果脚本作为 Web 应用程序发布,则应从 no-reply 帐户部署,并设置为以 no-reply@enterprise.com 的身份执行。

如果脚本是手动触发的,则必须由已登录为 no-reply 用户的某人触发。

更简单的选择是设置回复地址,如 Edward Wall 的答案所示。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接