简体   繁体   English

如何防止Google Apps脚本将已发送的电子邮件转发到转发地址

[英]How do I prevent Google Apps Script from forwarding sent email to the forwarding address

I am using MailApp.sendEmail to send mail FROM:SEND@example.com and TO: RECEIVE@example.com 我正在使用MailApp.sendEmail从以下地址发送邮件:SEND@example.com和至:RECEIVE@example.com

The SEND@example.com inbox automatically forwards all incoming mail to various other addresses in my organization. SEND@example.com收件箱会自动将所有传入邮件转发到组织中的其他各个地址。

The unintended consequences are that even though I only want these emails to be delivered to RECEIVE@example.com, they are automatically being forwarded to all of the email addresses that SEND@example.com forwards to as well. 意外的结果是,即使我只希望将这些电子邮件发送到RECEIVE@example.com,它们也会自动转发到SEND@example.com也转发到的所有电子邮件地址。

This doesn't seem logical, as it is an outgoing email and if I simply send an email from the SEND@example.com inbox normally, the sent mail does not get forwarded. 这似乎不合逻辑,因为它是外发电子邮件,并且如果我通常只是从SEND@example.com收件箱发送电子邮件,则所发送的邮件将不会被转发。

Can anyone explain why this happens and/or a way around it? 谁能解释为什么会这样和/或解决方法?

I believe it happens because the copy google's servers (running the apps script) places in the sending account's mail folders is treated by gmail as a new incoming message that just happens to have the from field set to be that account itself. 我相信这是因为将google服务器(运行apps脚本)放置在发送帐户的邮件文件夹中的副本被gmail当作新的传入邮件,而恰好恰好具有from字段设置为该帐户本身。 It then performs whatever rules it always performs on incoming messages. 然后,它将执行对传入消息始终执行的任何规则。

You can set your rules for that gmail account to forward except in the case that the from address is your own email address. 您可以设置该Gmail帐户的转发规则,除非发件人地址是您自己的电子邮件地址。 When you create the filter enter "-SEND@example.com" in the from field. 创建过滤器时,在“发件人”字段中输入“ -SEND@example.com”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM