MailApp.sendEmail 方法无法访问正文中带有 URL 的帐户 - 消息已阻止 [英] MailApp.sendEmail method doesn't get through to accounts with URL in the body - Message Blocked

查看:28
本文介绍了MailApp.sendEmail 方法无法访问正文中带有 URL 的帐户 - 消息已阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 Google Apps 脚本.我正在尝试按如下方式发送电子邮件:

function test_sendmail(){var 主题 = "主题";var body = "https://www.google.com/";var emailBody = body;变量选项 = {htmlBody: 正文}var 收件人 = "XXXXXXXXX@gmail.com";MailApp.sendEmail(收件人,主题,emailBody,选项);}

"XXXXXXXXX@gmail.com"(电子邮件地址 A)无效,但它仅用于向您展示示例.我在 GAS 执行中使用了真实的电子邮件地址.

GAS 执行由另一个 G-suite 域 google 帐户(电子邮件地址 B)运行,该帐户是通过该帐户编写代码的.

电子邮件地址 A 在 GAS 编辑器中拥有对具有上述代码的电子表格的编辑权限.

但是,来自上述功能的电子邮件没有通过电子邮件地址 A.我在电子邮件地址 B 中收到了这封电子邮件.

了解更多:

最近发生了从 1 周或 2 周前向电子邮件地址 A 等电子邮件地址发送带有 URL 的电子邮件失败的情况.在此之前,这4个案例已经成功完成.我不知道为什么最近开始发生这种情况.

我检查了发件人电子邮件地址 B 是否在收件人电子邮件地址 A 的联系人列表中.

它不在我的联系人中.

但是当我搜索它时,它出现了,所以它似乎在所有联系人中.

<小时>

添加了 1 个:我尝试向电子邮件地址 C 发送电子邮件,该地址是与电子邮件地址 B 位于同一域中的另一个 G 套件邮件地址,但电子邮件地址 C 无权访问电子表格和编辑器.

即使它没有电子表格的权限,它也成功发送到电子邮件 C.

<小时>

添加了 2 个:我尝试向电子邮件地址 D 发送电子邮件,该地址是其他电子邮件地址,既不是 G-suite 域也不是 @google.com 地址.结果与电子邮件地址 A 相同.

<小时>

解决方案

Gmail 反垃圾邮件算法很复杂.为防止您的脚本发送的消息被他们阻止,请遵循 上的准则防止发送给 Gmail 用户的邮件被阻止或发送到垃圾邮件

<小时>

可能的解决方法

我的一个客户遇到了同样的问题,我用 GmailApp.sendEmail(recipient,subject,body,options) 替换了 MailApp.sendEmail(message) 显然这有效(10 分钟后没有退回邮件)

Rafa Guillermo 在评论中添加:

<块引用>

只是想补充一点,如果这是一个持续存在的问题,您应该让您的管理员联系 G Suite 支持

如果您无法访问 G Suite 支持,我认为您可以使用 Google 反馈(打开 Gmail 网页界面 > 点击设置按钮(齿轮图标)> 发送反馈)向 Google 报告此问题

相关

I am working on Google Apps Script. I am trying to send email as follows:

function test_sendmail(){
  var subject = "subject";
  var body = "https://www.google.com/";
  var emailBody = body;
  var options = {
    htmlBody: body
  }

  var recipient = "XXXXXXXXX@gmail.com";

  MailApp.sendEmail(recipient, subject, emailBody, options);
}

"XXXXXXXXX@gmail.com"(email address A) is not valid, but it's only for showing you an example. I use a real email address in the GAS execution.

The GAS execution is run by another G-suite domain google account(email address B) by which account the code is written.

The email address A has editing rights to the spreadsheet that has the above code in the GAS editor.

But, the email from the above function doesn't get through the email address A. I got this email in the email address B.

LEARN MORE: https://support.google.com/mail/answer/6596?visit_id=637267406328019079-2003975007&rd=1

Then, I replace the email address with the email address B. and I tried to send it, and it did get through successfully.

Secondly, I changed the URL part:

var body = "https://www.google.com/";

to:

var body = "";

Then, the email successfully get through to both email addresses A and B.

The results listed as below:

The failure of sending email with URL to email address like the email address A has occurred recently like from 1 week or 2 weeks ago. Until then, the 4 cases had been successfully done before. I have no idea why this started happening recently.

I checked if the sender email address B is in the contact list of the recipient email address A.

It is not in my contacts.

But when I searched it, it appeared, so it seems in all contacts.


Added 1: I tried sending email to the email address C which is another G-suite mail address in the same domain as the email address B, but email address C doesn't have rights to the spreadsheet and the editor.

It sent to the email C successfully even it has no right to the spreadsheet.


Added 2: I tried sending email to the email address D which is other email address that is neither G-suite domain or @google.com address. The result is the same as the email address A.


解决方案

Gmail anti-spam algorithms are complex. To prevent that the messages sent by your script being blocked by them, follow the guidelines on Prevent mail to Gmail users from being blocked or sent to spam


Possible Workaround

One of my clients had the same issue, I replaced MailApp.sendEmail(message) by GmailApp.sendEmail(recipient,subject,body,options) apparently this worked (No bounce messages after 10 minutes)

Rafa Guillermo added in a comment:

Just want to add that in this case if this is an ongoing issue you should get your admin to contact G Suite support

If you hasn't access to G Suite Support I think that you could report this issue to Google by using Google Feedback (Open Gmail web UI > click the settings button (gear icon) > Send feedback)

Related

这篇关于MailApp.sendEmail 方法无法访问正文中带有 URL 的帐户 - 消息已阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆