Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony-“是的;503 5.5.2需要rcpt命令;使用Swiftmailer向外部地址发送邮件时的消息_Php_Symfony_Email_Swiftmailer - Fatal编程技术网

Php Symfony-“是的;503 5.5.2需要rcpt命令;使用Swiftmailer向外部地址发送邮件时的消息

Php Symfony-“是的;503 5.5.2需要rcpt命令;使用Swiftmailer向外部地址发送邮件时的消息,php,symfony,email,swiftmailer,Php,Symfony,Email,Swiftmailer,我正在尝试在Symfony 4应用程序中通过swiftmailer发送电子邮件。这是我的swiftmailer.yaml配置文件: swiftmailer: mailers: mailer_smtp: url: '%env(MAILER_URL)%' spool: { type: 'memory' } transport: smtp host: xxxxxxxxxxxxxx

我正在尝试在Symfony 4应用程序中通过swiftmailer发送电子邮件。这是我的swiftmailer.yaml配置文件:

swiftmailer:
    mailers:
        mailer_smtp:
            url: '%env(MAILER_URL)%'
            spool: { type: 'memory' }
            transport: smtp
            host: xxxxxxxxxxxxxx
            port: 25
            encryption:
            username:
            password:
            auth_mode: login
    default_mailer: mailer_smtp
我只能向本地地址发送电子邮件,当我尝试向外部地址发送电子邮件时,我得到以下信息:

app.ERROR:刷新电子邮件队列时发生异常:预期响应代码354,但收到代码“503”,消息为“503 5.5.2需要rcpt命令”

我有另一个PHP应用程序(不使用Symfony或swiftmailer),可以向任何具有类似配置的地址(本地或外部)发送电子邮件: 端口25上的连接,无需身份验证。这在我们的exchange服务器上是允许的,只要源IP得到授权

我这样更改了我的swiftmailer.yaml:

swiftmailer:
    mailers:
        mailer_smtp:
            url: '%env(MAILER_URL)%'
            spool: { type: 'memory' }
            transport: smtp
            host: xxxxxxxxxxxxx
            port: 25
            encryption:
            username:  xxxxxxxx@xxxxx.xx
            password: xxxxxxx
            auth_mode: login
    default_mailer: mailer_smtp
然后我将此错误发送到任何地址(外部或本地电子邮件):

app.ERROR:刷新电子邮件队列时发生异常:无法使用0个可能的身份验证程序在用户名为“xxx”的SMTP服务器上进行身份验证。[][]

如果发送电子邮件的函数在SetFrom属性中使用的是我在swiftmail.yaml中填写的同一用户:

 $message = (new Swift_Message($evenement->getNomEvenement()))
            ->setFrom("xxxxxxxx@xxxxx.xx")
            ->setTo($mail)
你有办法解决这个问题吗


谢谢你的帮助

这回答了你的问题吗?谢谢你的回复。不幸的是,本页中描述的解决方案都不适用于我:(