我想使用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