我的Google表格脚本无法向Facebook群组

时间:2016-05-24 18:41:00

标签: email google-sheets

我在google工作表中写了一个非常简单的电子邮件脚本。

我已经使用自己的电子邮件地址测试了脚本,但是当我使用Facebook的GRoup电子邮件地址时,电子邮件会从Facebook反弹并显示“POL-P6 http://postmaster.facebook.com/response_codes?ip=209.85.220.199#pol-m消息被拒绝”消息。

如果我使用gmail而不是工作表向facebook群发送完全相同的电子邮件,则电子邮件不会退回,并且已成功发布。

我认为这与SPF和DKIM有关,但我不确定。我对此表示赞赏。

我可以接受的解决方案:

1)如何正确设置SPF / DKIM以允许工作表发送电子邮件。 2)免费的电子邮件调度程序,它将从预配置的文件中读取主题和正文,并在将来的日期发送电子邮件 3)我明显忽视的其他配置。

我包含了我在这里使用的代码:

function sendEmails() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2;  // First row of data to process
  var numRows = 10;   // Number of rows to process
  // Fetch the range of cells A2:B3
  var dataRange = sheet.getRange(startRow, 1, numRows, 6)
  // Fetch values for each row in the Range.
  var data = dataRange.getValues();
  for (i in data) {
    var row = data[i];
    var emailAddress = row[0];  // First column
    var subject = row[1];       // Second column
    var message = row[2];       // Third column
    if(emailAddress != "")
    {
      MailApp.sendEmail(emailAddress, subject, message);
    }
  }
}

这是表格中的一个样本,而不是我正在使用的样本:

Email                       Subject                             Message                                     Date        Time        Repeat
xxxx@groups.facebook.com    Check out all the other languages   https://www.facebook.com/xxxxxxxxxx/events  24/05/2016  16:00:00    Weekly

这是我从Facebook服务器收到的错误消息:

Delivery to the following recipient failed permanently:

     xxxx@groups.facebook.com

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain groups.facebook.com by msgin.vvv.facebook.com. [66.220.159.18].

The error that the other server returned was:
554 5.7.1 POL-P6 http://postmaster.facebook.com/response_codes?ip=209.85.220.200#pol-m Message refused


----- Original message -----

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:message-id:date:subject:from:to;
        bh=Tha9xrs+SsMgr1f6g/kqP/M1YN17QMZsR4wIogukb7M=;
        b=LW0tiMl7DvjD0DnUf/rU0YANFsVkSGZ2pPiBZwQMv00hK3JvRwjLXseDzhVddgBKY0
         1tfxnBuff7oGruFgdwf3rDddchU77CoVKCH6sQvBNU6d442lWdrqSpw8UBTuJUPrucz/
         kN+PKHe+5hPnl4tiPWnL3P9Nnw1Q/jPOkq5LCbVDHBK55nXaceBZRyp1B8474SrLN6AX
         MicGGoSK74BJsvKYdTubzjCLvpiC2LVj4kmRPz3YBuMQhPZrkNGUQ09WNXxeyDJ2mAdL
         TZv/K7ZA5eRNvhbdDWoA4QFdzfWEHejnBBj+yfGVSNUue2OrAD7hKlEDrupmm0sQHPLi
         RQKw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:message-id:date:subject:from:to;
        bh=Tha9xrs+SsMgr1f6g/kqP/M1YN17QMZsR4wIogukb7M=;
        b=kC7S8oDRlE8ACX2wizIPkQbQlNjZaUXIn2jePw+/cmqoVYNAH7vwslcQPhrjjRkLlP
         FcztAQTp7blzosxqmxz1M9jijPnokphR6rH1t17l9V7hcNjX92xc2PRRkuSDauIt6OjK
         FtTJgwDjQhz0ilHMqntJIVzjA+J964eEH6m1eLceTKAcz+5+ukcUSg/LHVXOe3IS34SE
         M5CHm5jkYWQxL6vLJYNfPbE+6tMLwvLmkYkGmPtVD0Sxghn1IYtinHpaC/e5n8MA7REe
         V1gI+Fl6ki3CgVLLOCKcYs4dhYIVG4Bk6TkspMkrbWJwLuPsWCHBVoDNXa26eS2nfkzu
         RkDA==
X-Gm-Message-State: ALyK8tKUQtlhdFcKfFUpHkCdvkXIiAo1Qny6c/VPOHziRvjSsAUUrZP+GpsNS0iKSW0zfa7dbxPsOHZpoicerg==
MIME-Version: 1.0
X-Received: by 10.129.71.213 with SMTP id u204mr3993391ywa.51.1464114280537;
 Tue, 24 May 2016 11:24:40 -0700 (PDT)
Message-ID: <001a114c6ec09a28e405339aab2a@google.com>
Date: Tue, 24 May 2016 18:24:40 +0000
Subject: Check out all the other languages
From: mmmmm@gmail.com
To: xxxx@groups.facebook.com
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes

https://www.facebook.com/xxxxxxxxx/events

感谢任何帮助。

谢谢。

1 个答案:

答案 0 :(得分:0)

因此,在向Facebook报告问题后,电子邮件开始到达组页面。所以,这不是内容,而是在FB方面被阻止了。问题解决了。祝所有遇到同样问题的人好运。