From c4cbd9f4e4a1a03249f1e41e5e4cc8cc225c075b Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 31 Mar 2016 08:44:31 -0700 Subject: [PATCH] mailer: check for the correct SPF record --- src/cloudron.js | 1 + src/mailer.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cloudron.js b/src/cloudron.js index 6c73f1509..ce4e54e94 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -359,6 +359,7 @@ function readDkimPublicKeySync() { return publicKey; } +// NOTE: if you change the SPF record here, be sure the wait check in mailer.js function txtRecordsWithSpf(callback) { assert.strictEqual(typeof callback, 'function'); diff --git a/src/mailer.js b/src/mailer.js index 068fecdf1..953ef46ef 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -110,10 +110,11 @@ function getTxtRecords(callback) { }); } +// keep this in sync with the cloudron.js dns changes function checkDns() { getTxtRecords(function (error, records) { if (error || !records) { - debug('checkDns: DNS error or no records looking up TXT records for %s %s', config.fqdn(), error, records); + debug('checkDns: DNS error or no records looking up TXT records for %s %s', config.adminFqdn(), error, records); gCheckDnsTimerId = setTimeout(checkDns, 60000); return; } @@ -123,7 +124,7 @@ function checkDns() { for (var i = 0; i < records.length; i++) { if (records[i].indexOf('v=spf1 ') !== 0) continue; // not SPF - allowedToSendMail = records[i].indexOf('a:' + config.fqdn()) !== -1; + allowedToSendMail = records[i].indexOf('a:' + config.adminFqdn()) !== -1; break; // only one SPF record can exist (https://support.google.com/a/answer/4568483?hl=en) }