Swiftmailer不会在Symfony Controller上刷新电子邮件


Swiftmailer not flush emails on Symfony Controller

>我创建了一个简单的项目,用于从 swiftmailer 发送电子邮件,但是,消息是从控制台传递的,而不是从控制器传递的。我的代码是

$message = 'Swift_Message::newInstance('hello','test message', 'text/plain','Cp1252')
    ->setFrom('service@mycompany.com')->setTo('myuser@mycompany.com');
    $this->get('mailer')->send($message);
  • PHP 是 5.6
  • SMTP 服务器是 IIS 6
  • Apache是从xampp安装的
  • S.O. 是 Windows Server 2008

我尝试使用Symfony 2.7和Symfony 3.0与Swiftmailer 5.4,以及编码UTF-8和Cp1252

dev.log 上的错误消息是 .app。错误:刷新电子邮件队列时发生异常:预期响应代码 250,但收到代码"501",消息"501 5.5.4 地址无效" [] []

当我从控制台发送电子邮件时,这可以正常工作。

提前谢谢。

为了解决我在没有 http://localhost 但网络 http://hostname 的情况下运行脚本,但是,我不知道如何在开发环境中正确运行 en 开发环境