Eu tenho o postfix com o dovecot configurado no Ubuntu 13.10. Eu envio e-mails por meio de um aplicativo de nó (usando modelos de e-mail).
Se eu enviar um email de [email protected]
para [email protected]
( email 1 ), o registro spf será transmitido.
Se eu enviar um email de [email protected]
para [email protected]
( email 2 ), o registro spf falhará.
Meu registro spf:
v=spf1 a mx ~all
Eu tentei uma variação especificando o ip, mas recebi o mesmo passe / softfail para os e-mails 1 e 2 .
Eu vinculei meus e-mails @ mydomain.com ao gmail, para que eu possa lê-los de lá e também verificar os cabeçalhos no gmail.
Aqui está o cabeçalho do email 1 , que passa:
Delivered-To: [email protected]
Received: by 10.220.131.9 with SMTP id v9csp9729vcs;
Thu, 3 Apr 2014 02:07:44 -0700 (PDT)
X-Received: by 10.204.243.137 with SMTP id lm9mr3945288bkb.33.1396516062351;
Thu, 03 Apr 2014 02:07:42 -0700 (PDT)
Return-Path: <[email protected]>
Received: from mydomain.com (mydomain.com. [81.4.107.88])
by mx.google.com with ESMTPS id de1si2116722bkc.265.2014.04.03.02.07.41
for <[email protected]>
(version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Thu, 03 Apr 2014 02:07:41 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 81.4.107.88 as permitted sender) client-ip=81.4.107.88;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of [email protected] designates 81.4.107.88 as permitted sender) [email protected]
Received: from [127.0.0.1] (mydomain [127.0.0.1])
(Authenticated sender: username)
by mydomain.com (Postfix) with ESMTPA id 2FE0730A095F
for <[email protected]>; Thu, 3 Apr 2014 05:07:41 -0400 (EDT)
X-Mailer: Nodemailer (0.6.1; +http://github.com/andris9/nodemailer;
smtp/0.3.23)
Date: Thu, 03 Apr 2014 09:07:41 GMT
Message-Id: <[email protected]>
From: [email protected]
To: [email protected]
Subject: Welcome to mydomain
Aqui está o cabeçalho do email 2 , que falha:
Delivered-To: [email protected]
Received: by 10.220.131.9 with SMTP id v9csp9756vcs;
Thu, 3 Apr 2014 02:08:20 -0700 (PDT)
X-Received: by 10.220.103.141 with SMTP id k13mr2007429vco.25.1396516099631;
Thu, 03 Apr 2014 02:08:19 -0700 (PDT)
Authentication-Results: mx.google.com;
spf=softfail (google.com: best guess record for domain of transitioning [email protected] does not designate <unknown> as permitted sender) [email protected]
Received-SPF: softfail (google.com: best guess record for domain of transitioning [email protected] does not designate <unknown> as permitted sender)
Received: by 10.220.241.77 with POP3 id ld13mf1851813vcb.12;
Thu, 03 Apr 2014 02:08:19 -0700 (PDT)
X-Gmail-Fetch-Info: [email protected] 3 mail.mydomain.com 110 support
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from [127.0.0.1] (mydomain [127.0.0.1])
(Authenticated sender: username)
by mydomain.com (Postfix) with ESMTPA id 2DF0730A095E
for <[email protected]>; Thu, 3 Apr 2014 05:07:41 -0400 (EDT)
X-Mailer: Nodemailer (0.6.1; +http://github.com/andris9/nodemailer;
smtp/0.3.23)
Date: Thu, 03 Apr 2014 09:07:41 GMT
Message-Id: <[email protected]>
From: [email protected]
To: [email protected]
Subject: New user signed-up
Content-Type: multipart/alternative;
boundary="----Nodemailer-0.6.1-?=_1-1396516061189"
MIME-Version: 1.0
Não acho que o problema esteja no código node.js que está enviando os e-mails, pois ambos usam os mesmos transportes e logins. Aqui está uma versão simplificada, mas ainda longa, do código:
var transport = nodemailer.createTransport("SMTP", {
service: "mydomain.com",
auth: {
user: "username",
pass: "password"
}
})
//THIS EMAIL FAILS SPF CHECK
exports.send_new_registration = function(username, email){
emailTemplates(templatesDir, function(err, template) {
console.log("Attempting to send email.");
if (err) {
console.log(err);
} else {
var locals = {
email : email,
username :username
};
// Send a single email
template('new_user', locals, function(err, html, text) {
if (err) {
console.log(err);
} else {
transport.sendMail({
from: '[email protected]',
to: '[email protected]',
subject: "New user signed-up",
html: html,
// generateTextFromHTML: true,
text: text
}, function(err, responseStatus) {
if (err) {
console.log(err);
} else {
console.log(responseStatus.message);
}
});
}
});
}
//THIS EMAIL PASSES SPF CHECK
exports.send_confirmation_email = function(email, token){
var link = "https://mydomain.com/email-confirmation/" + token;
emailTemplates(templatesDir, function(err, template) {
console.log("Attempting to send email.");
if (err) {
console.log(err);
} else {
var locals = {
link : link
};
// Send a single email
template('register', locals, function(err, html, text) {
if (err) {
console.log(err);
} else {
transport.sendMail({
from: '[email protected]',
to: email,
subject: "Welcome to mydomain",
html: html,
// generateTextFromHTML: true,
text: text
}, function(err, responseStatus) {
if (err) {
console.log(err);
} else {
console.log(responseStatus.message);
}
});
}
});
}
});
}
Eu não acho que seja relevante, mas ainda tenho que trabalhar com o TLS no postfix. Eu também tentei obter postfix-policyd-spf-perl
funcionando, sem sucesso, ainda. Ao enviar um e-mail para minha conta, por conta própria, adicione um cabeçalho adicional. Eu estou supondo que seja relacionado, mas não tenho certeza.
Como FYI, se eu adicionar check_policy_service unix:private/policy-spf
ao meu /etc/postfix/main.cf
, o cabeçalho adicional que eu vejo no e-mail de [email protected]
to [email protected]
é:
Received-SPF: softfail (mydomain.com: Sender is not authorized by default to use
'[email protected]' in 'mfrom' identity, however domain is not currently prepared for false
failures (mechanism '~all' matched)) receiver=mydomain.com; identity=mailfrom; envelope-
from="[email protected]"; helo="[an_ip]"; client-ip=a_diff_ip
Eu só adiciono isso porque não tenho certeza se isso está relacionado ou não com a verificação do google softfail ...
EDIT: Para esclarecer a questão, não está claro para mim por que, se eu enviar um email para uma conta do Gmail, ele passa a verificação SPF, mas se eu enviar um email para o meu próprio domínio, ele falhará. >