Symfony 3不能发送邮件测试


Symfony 3 can't send email test

我是Symfony 3的新手(一般是Symfony)
我想发一封电子邮件,只是为了测试我的参数,如果一切顺利的话,但那不起作用。
这是我的参数。html文件:

database_host: 127.0.0.1
database_port: null
database_name: learnsymfony
database_user: root
database_password: null
mailer_transport: gmail
mailer_encryption: ssl
mailer_auth_mode: login
mailer_host: smtp.gmail.com
mailer_user: 'personalemail@gmail.com'
secret: 7759e1c20bb67e4ec0fbac5c3a4de22beed3b95d

和这是我的配置。swiftmailer的Yml代码:

transport: gmail
host:      smtp.gmail.com
username:  'personalemail@gmail.com'
password:  'myPassword'
spool: { type: memory }

我在论坛的一个问题中发现了这个配置,但对于我的情况,这是一个错误"在刷新电子邮件队列时发生异常:无法与主机smtp.gmail.com建立连接[#0]"
有什么建议吗?
我尝试了很多其他配置,但没有一个效果很好…
由于

我今天也遇到了这个问题,并通过以下方法解决了如何在Symfony中发送电子邮件执行以下步骤后,不要忘记在默认控制器中导入这些内容:

使用Symfony'Component'Routing'Annotation'Route作为Route;

组件使用Symfony ' ' HttpFoundation '反应;

并确保您的电子邮件和密码,您正在使用#app/config/parameters。