我在向yahoo.com电子邮件地址发送电子邮件时遇到问题,我从我的php脚本发送的邮件完全适用于我发送给其他每个坚持保留她的雅虎电子邮件的用户的域名。
这是我的标题
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "Date: $date";
$headers[] = "From: 'DSAC Events' <$from>";
$headers[] = "Reply-To: <$replyto>";
$headers[] = "Subject: {$subject}";
$headers[] = "Return-Path: <$from>";
$headers[] = "X-Priority: 3";//1 = High, 3 = Normal, 5 = Low
$headers[] = "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $msg, implode("\r\n", $headers));
我已经阅读了很多有关同一问题的人的帖子,我尝试添加了一条消息ID和返回路径我已经添加了日期:阅读后可能会出现问题,各种其他事情无济于事。
以下是退回邮件来源的示例。
Return-path: <>
Envelope-to: d11dsa@zeus1.easy-internet.co.uk
Delivery-date: Sat, 08 Nov 2014 14:41:32 +0000
Received: from mailnull by zeus1.easy-internet.co.uk with local (Exim 4.82)
id 1Xn7Cm-001cxb-8a
for d11dsa@zeus1.easy-internet.co.uk; Sat, 08 Nov 2014 14:41:32 +0000
X-Failed-Recipients: user@yahoo.com
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@zeus1.easy-internet.co.uk>
To: d11dsa@zeus1.easy-internet.co.uk
Subject: Mail delivery failed: returning message to sender
Message-Id: <E1Xn7Cm-001cxb-8a@zeus1.easy-internet.co.uk>
Date: Sat, 08 Nov 2014 14:41:32 +0000
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
user@yahoo.com
SMTP error from remote mail server after end of data:
host mta6.am0.yahoodns.net [63.250.192.46]: 554 Message not allowed - Headers are not RFC compliant[291]
------ This is a copy of the message, including all the headers. ------
Return-path: <d11dsa@zeus1.easy-internet.co.uk>
Received: from d11dsa by zeus1.easy-internet.co.uk with local (Exim 4.82)
(envelope-from <d11dsa@zeus1.easy-internet.co.uk>)
id 1Xn7Ci-001cl4-9S
for user@yahoo.com; Sat, 08 Nov 2014 14:41:29 +0000
To: user@yahoo.com
Subject:
X-PHP-Script: www.dsa.co.uk/eventmail.php for 2.218.47.72
MIME-Version: 1.0
Content-type: text/plain; charset=iso-8859-1
Date: Sat, 08 Nov 2014 14:41:28 +0000
From: DSACEvents <events@dsa.co.uk>
Reply-To: <person@live.co.uk>
Subject:
X-Priority: 3
答案 0 :(得分:4)
感谢您的回复,你是对的。这就是我最终最终完成的工作。
function generateMessageID()
{
return sprintf(
"<%s.%s@%s>",
base_convert(microtime(), 10, 36),
base_convert(bin2hex(openssl_random_pseudo_bytes(8)), 16, 36),
$_SERVER['SERVER_NAME']
);
}
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "Mesaage-id: " .generateMessageID();
$headers[] = "From: 'DSAC Events' <$from>";
$headers[] = "Reply-To: $Arranger <$replyto>";
$headers[] = "Date: $date";
$headers[] = "Return-Path: <$from>";
$headers[] = "X-Priority: 3";//1 = High, 3 = Normal, 5 = Low
$headers[] = "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, implode("\r\n", $headers));
答案 1 :(得分:0)
根据错误消息,雅虎服务器似乎拒绝来自您的域SMTP服务器的电子邮件。这可能是由以下几个原因引起的:
如果您的计划发送的邮件中没有var express = require('express');
var router = express.Router();
var session = require('express-session');
var sql = require('mssql');
/* GET users listing. */
router.get("/cadastro/nome=:nome&email=:email&senha=:senha",function(req, res, next) {
var sess = req.session;
var config = {
user: sess.cookie.user,
password: sess.cookie.password,
server: sess.cookie.server,
database: sess.cookie.database};
//Verificar codigo do usuário
var queryConsulta = 'select cod_usuario_usu from [bd_iglu].[dbo].[tb_igl_usuario] where cod_usuario_usu = @codigo';
verificarCodigoUsuario(config, req, queryConsulta);
res.send("ok");
});
function verificarCodigoUsuario(config, req, query) {
var codigo = req.params.email.split("@", 1);
var connection = new sql.Connection(config, function (err) {
var ps = new sql.PreparedStatement(connection);
ps.input('codigo', sql.VarChar(100));
ps.prepare(query, function (err) {
ps.execute({
codigo: codigo
}, function (err, recordset) {
ps.unprepare(function (err) {
});
console.log(recordset);
return recordset;
});
});
});
};
module.exports = router;
或Message-ID
标题
如果附件不符合该文件类型的确切结构,则这些附件也会被视为可疑,因此会被隔离,以防它们构成任何形式的威胁。
如果邮件有2个主题,则可以拒绝邮件。
答案 2 :(得分:-1)
我在Yahoo上遇到了同样的问题。问题只有双重“主体”。干得好,对我来说很好。