我正在按照以下代码发送电子邮件:
$transport = new \Zend_Mail_Transport_Smtp(
// some code here for my transport
);
$mail = new \Zend_Mail('UTF-8');
$mail->setBodyHtml('this is the email body');
$mail->setFrom('no-reply@somesite.com', 'Do not reply to this email');
$mail->addTo('someone@somewhere.com', 'Some Name');
$mail->setReplyTo('replyto@somesite.com');
$mail->setSubject('Test');
$mail->send($transport);
电子邮件已按预期发送。但是,“ from”始终显示为:
no-reply <no-reply@somesite.com>
代替:
Do not reply to this email <no-reply@somesite.com>
我在$ mail-> send之前在$ mail-> getHeaders()上执行var_dump,这对我来说是正确的:
array(4) {
["From"]=>
array(2) {
[0]=>
string(49) "Do not reply to this email <no-reply@somesite.com>"
["append"]=>
bool(true)
}
["To"]=>
array(2) {
[0]=>
string(33) "Some Name <someone@somewhere.com>"
["append"]=>
bool(true)
}
["Reply-To"]=>
array(2) {
[0]=>
string(20) "replyto@somesite.com"
["append"]=>
bool(true)
}
["Subject"]=>
array(1) {
[0]=>
string(4) "Test"
}
}
此行为在不到一个月前开始。以前,“来自”始终是正确的。在软件本身或相关库的版本方面,软件没有任何变化。
我认为这可能是具有某些怪异设置的电子邮件客户端,但似乎同时在office365和gmail上都发生过。
任何人都有类似的行为可以在这里阐明一些东西吗?