时不能“从”字段设置我尝试使用ZF2Zend框架2 - 发送电子邮件
$message = new \Zend\Mail\Message();
$message->setBody('This is the body');
$message->setFrom('[email protected]');
$message->addTo('[email protected]');
$message->setSubject('Test subject');
$smtpOptions = new \Zend\Mail\Transport\SmtpOptions();
$smtpOptions->setHost('smtp.gmail.com')
->setConnectionClass('login')
->setName('smtp.gmail.com')
->setConnectionConfig(array(
'username' => '[email protected]',
'password' => 'mypassword',
'ssl' => 'tls',
'port' => '123',
));
$transport = new \Zend\Mail\Transport\Smtp($smtpOptions);
$transport->send($message);
我希望发件人是“[email protected]”,但它总是'发送电子邮件[email protected]'
我该如何解决这个问题?我做错了什么?
编辑:
我也具有相同的结果
在“admin @ mydomain.com.com”中搜索您所有的项目 - 很可能你不会找到它。如果是这样,那么你的服务器配置设置为在发送之前简单地覆盖特定的邮件头。 – Sam
它只在一个地方,谢谢 – Thermech