下面的代碼工作我使用的服務器(HOSTEUROPE的WebPack)上:與Swiftmailer控制的Sendmail中的Symfony
mail('[email protected]', 'some subject', 'sendmail is working', 'From: [email protected]', "");
下面的代碼是不是:
$message = \Swift_Message::newInstance()
->setSubject('some subject')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody('sendmail via swiftmail is working');
$mailer = $this->get('mailer');
$logger = new Swift_Plugins_Loggers_ArrayLogger();
$mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));
$mailer->send($message);
而且在$記錄器寫入這個錯誤:
++ Starting Swift_Transport_SendmailTransport
<<
!! Expected response code 220 but got code "", with message "" (code: 0)"
...
我的配置是:
swiftmailer:
transport: "sendmail"
sender_address: "[email protected]"
我不明白爲什麼一個正在工作,另一個是因爲,據我所知,這個電話應該是相同的。