Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.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/2/github/3.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 Symfony2:尝试使用Swiftmailer发送电子邮件时出错_Php_Symfony_Swiftmailer - Fatal编程技术网

Php Symfony2:尝试使用Swiftmailer发送电子邮件时出错

Php Symfony2:尝试使用Swiftmailer发送电子邮件时出错,php,symfony,swiftmailer,Php,Symfony,Swiftmailer,当我试图用swift发送电子邮件时,我遇到了以下问题: Symfony2项目:刷新电子邮件队列时发生异常:预期响应代码为220,但获得代码“”,带有消息“” 我在localhost中,我尝试使用我的主机OVH的邮件。以下是我的config.yml: # Swiftmailer Configuration swiftmailer: transport: "%mailer_transport%" auth_mode: "%mailer_auth_mode%" host:

当我试图用swift发送电子邮件时,我遇到了以下问题: Symfony2项目:刷新电子邮件队列时发生异常:预期响应代码为220,但获得代码“”,带有消息“”

我在localhost中,我尝试使用我的主机OVH的邮件。以下是我的config.yml:

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    auth_mode: "%mailer_auth_mode%"
    host:      "%mailer_host%"
    port:      "%mailer_port%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }
和my parameters.yml:

# This file is auto-generated during the composer install
parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: null
    database_name: ********
    database_user: root
    database_password: null
    mailer_transport: mail
    mailer_auth_mode: login
    mailer_host:  ns0.ovh.net
    mailer_port: 587
    mailer_user: contact@******.com
    mailer_password: **********
    locale: fr
    secret: ThisTokenIsNotSoSecretChangeIt

谢谢你

你安装了什么版本的SwiftMailer?SwiftMailer 5.4.5不推荐使用邮件传输

从SWIFTMail 5.4.5开始,邮件传输被禁止,将在版本6中删除。考虑使用另一种传输方式,如SMTP、SeNail或Gmail。

您可以通过以下链接查看更多信息:

您需要更改
邮件传输
。尝试此配置,编辑端口、加密、主机

参数.yml

parameters:
    mailer_transport: smtp
    mailer_host: smtp.example.com
    mailer_user: user@example.com
    mailer_password: my_password
    mailer_port: 587
    mailer_encryption: tls