我想使用symfony發送電子郵件,但swiftmailer不發送任何電子郵件。我甚至沒有得到錯誤報告或其他任何東西。這就是我的代碼:swiftmailer不發送電子郵件
$mail = \Swift_Message::newInstance()
->setSubject('Subject')
->setTo('[email protected]') #this is replaced by real email of course
->setFrom('[email protected]')
->setBody('Testbody');
$this->get('mailer')->send($mail);
那的配置:
swiftmailer:
default_mailer: mailer
mailers:
mailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
#spool: { type: memory }
我什至主機設置爲不存在的地址,但我不從swiftmailer或symfony中得到任何錯誤。
我試圖找到的lib文件,但在symfony的任何地方的文件沒有Swift_Message或的newInstance,奇怪
你正在使用SM config正在使用的參數是什麼?你也有一個運行郵件服務器? – stevenll
你想擁有我的郵件服務器憑據嗎? :)它的外部郵件服務器。例如,當我將服務器主機更改爲非工作地址時,如果外部郵件工作正常,我甚至不會收到swiftmailer – Asara
的任何錯誤,那麼此處顯示的代碼看起來不錯。你確定沒有別的東西阻止你的代碼發送消息嗎? – stevenll