Email Swift邮件和Symfony([连接被拒绝#111])
当我尝试使用Symfony框架发送电子邮件时,我遇到了此错误。不久前,我遇到了这个问题,我(模糊地)记得,我必须更改php.ini设置,并将它们与/app/config/factories.yml匹配,才能让它正常工作 不幸的是,我最近不得不重建我的机器,邮件现在已经停止工作了——不幸的是,我记不起上次为了让ot工作做了什么 以下是我的app/config/factories.yml文件的内容片段:Email Swift邮件和Symfony([连接被拒绝#111]),email,symfony1,swiftmailer,Email,Symfony1,Swiftmailer,当我尝试使用Symfony框架发送电子邮件时,我遇到了此错误。不久前,我遇到了这个问题,我(模糊地)记得,我必须更改php.ini设置,并将它们与/app/config/factories.yml匹配,才能让它正常工作 不幸的是,我最近不得不重建我的机器,邮件现在已经停止工作了——不幸的是,我记不起上次为了让ot工作做了什么 以下是我的app/config/factories.yml文件的内容片段: all: mailer: class: sfMailer param:
all:
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host: localhost
port: 25
encryption: ~
username: ~
password: ~
注意:由于粘贴在这个控制台上,上面的缩进可能是错误的-不要因此而偏离正轨。YML在我的机器上很好
这是我尝试发送电子邮件时记录的错误消息:
[19-Feb-2011 14:50:13] PHP 20. userActions->executeRegisterComplete() /lib/vendor/symfony/symfony-1.3.8/lib/action/sfActions.class.php:60
[19-Feb-2011 14:50:13] PHP 21. sfMailer->send() /path/to/actions.class.php:355
[19-Feb-2011 14:50:13] PHP 22. Swift_Mailer->send() /lib/vendor/symfony/symfony-1.3.8/lib/mailer/sfMailer.class.php:300
[19-Feb-2011 14:50:13] PHP 23. Swift_Transport_AbstractSmtpTransport->start() /lib/vendor/symfony/symfony-1.3.8/lib/vendor/swiftmailer/classes/Swift/Mailer.php:74
[19-Feb-2011 14:50:13] PHP 24. Swift_Transport_StreamBuffer->initialize() /lib/vendor/symfony/symfony-1.3.8/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php:101
[19-Feb-2011 14:50:13] PHP 25. Swift_Transport_StreamBuffer->_establishSocketConnection() /lib/vendor/symfony/symfony-1.3.8/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:70
[19-Feb-2011 14:50:13] PHP 26. fsockopen() /lib/vendor/symfony/symfony-1.3.8/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233
[19-Feb-2011 14:50:13] Connection could not be established with host localhost [Connection refused #111]
问题可能是您没有禁用在开发环境中发送的邮件。您必须像这样完成配置_dev.yml:
imports:
- { resource: config.yml }
framework:
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: true
monolog:
handlers:
main:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
firephp:
type: firephp
level: info
assetic:
use_controller: true
swiftmailer:
disable_delivery: true
您必须设置:
- 禁用传送:true(不发送电子邮件)
- 拦截\u重定向:true(如果您想在调试栏中查看电子邮件)
- 问题可能是您没有禁用在开发环境中发送的邮件。您必须像这样完成配置_dev.yml:
imports:
- { resource: config.yml }
framework:
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: true
monolog:
handlers:
main:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
firephp:
type: firephp
level: info
assetic:
use_controller: true
swiftmailer:
disable_delivery: true
您必须设置:
- 禁用传送:true(不发送电子邮件)
- 拦截\u重定向:true(如果您想在调试栏中查看电子邮件)
all:
mailer:
param:
transport:
class: Swift_SmtpTransport
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: "xxx@gmail.com"
password: xxx-password
我总是喜欢并且一直工作; 我只是不使用本地主机smtp服务
all:
mailer:
param:
transport:
class: Swift_SmtpTransport
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: "xxx@gmail.com"
password: xxx-password
我的主机提供商也有同样的错误。我通过编辑factories.yml缩进来修复它。还要检查您的用户名/密码值。我的主机提供商也有同样的错误。我通过编辑factories.yml缩进来修复它。还要检查您的用户名/密码值。您还记得您在计算机上安装/配置邮件服务器(侦听端口25)的修复程序吗?因为看起来问题是现在没有人在听……这也是我的答案。安装postfix,然后再试一次。您是否还记得您在计算机上安装/配置邮件服务器(侦听端口25)的修复程序?因为看起来问题是现在没有人在听……这也是我的答案。安装postfix,然后再试一次。你说的是sf2.0,他似乎在使用sf1.3。你说的是sf2.0,他似乎在使用sf1.3had添加加密/端口,让自己能够使用
Mailjet
必须自己添加加密/端口才能使用Mailjet