I have tested the script by using my own email address, but when I use a Facebook GRoup email address, the email bounces back from Facebook with a "POL-P6 http://postmaster.facebook.com/response_codes?ip=209.85.220.199#pol-m Message refused" message.

If I send the exact same email to the facebook group using gmail, rather than sheets, the email does not bounce, and is successfully posted.

I'm thinking that this is related to SPF and DKIM, but I'm not sure. I would appreciate any light on this.

Possible solutions I'm open to:

1) How to correctly set the SPF/DKIM to allow sheets to send the email.

2) A free email scheduler that will read the subject and body from a preconfigured file, and send the email on a future date

3) Other config that I've obviously overlooked.

I'm including the code that I'm using here:

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);

}

}

}

This is a sample from the sheet than I'm using:

Email Subject Message Date Time Repeat

[email protected] Check out all the other languages https://www.facebook.com/xxxxxxxxxx/events 24/05/2016 16:00:00 Weekly

So, after reporting the problem to Facebook, the emails began arriving to the group page. So, it wasn't the content, but something blocked on FB's side. Problem solved. Good luck to anyone who has the same problem.