当我从 Windows 7 机器运行 Rails 项目时,我似乎无法在开发环境中发送电子邮件。我不断收到权限被拒绝错误。当我在我的 Mac 上运行相同的代码时,电子邮件就会发送出去。这让我相信它可能是 Windows 防火墙设置,但尽管关闭了防火墙并禁用了我的防病毒软件,但我仍然收到以下相同的错误:
权限被拒绝 - 连接(2)
C:/Ruby200-x64/lib/ruby/2.0.0/net/smtp.rb:540:in `initialize'
C:/Ruby200-x64/lib/ruby/2.0.0/net/smtp.rb:540:in `open'
C:/Ruby200-x64/lib/ruby/2.0.0/net/smtp.rb:540:in `tcp_socket'
C:/Ruby200-x64/lib/ruby/2.0.0/net/smtp.rb:550:in `block in do_start'
C:/Ruby200-x64/lib/ruby/2.0.0/timeout.rb:65:in `timeout'
C:/Ruby200-x64/lib/ruby/2.0.0/net/smtp.rb:549:in `do_start'
C:/Ruby200-x64/lib/ruby/2.0.0/net/smtp.rb:519:in `start' 邮件 (2.5.4)
lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!' 邮件
(2.5.4) lib/mail/message.rb:2129:in `do_delivery' 邮件 (2.5.4)
lib/mail/message.rb:232:in `block in delivery'
在 development.rb 中:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Setup_Mail 初始化程序:
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'mydomain.com',
:authentication => 'plain',
:user_name => 'info@mydomain.com',
:password => 'secret'
}
有什么建议么?