加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Zoho的Rails ActionMailer配置

发布时间:2020-12-16 19:58:21 所属栏目:百科 来源:网络整理
导读:任何人都有运气配置ActionMailer通过Zoho帐户发送电子邮件? 这些是我的设置: ActionMailer::Base.smtp_settings = { :address = "smtp.zoho.com",:port = 465,:domain = 'example.com',:user_name = 'steve@example.com',:password = 'n0tmypa$$w0rd',:aut
任何人都有运气配置ActionMailer通过Zoho帐户发送电子邮件?

这些是我的设置:

ActionMailer::Base.smtp_settings = {
    :address              => "smtp.zoho.com",:port                 => 465,:domain               => 'example.com',:user_name            => 'steve@example.com',:password             => 'n0tmypa$$w0rd',:authentication       => :login
}

但是,调用.deliver超时:

irb(main):001:0> AdminMailer.signup_notification('asfd').deliver
Timeout::Error: Timeout::Error
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
        from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:929:in `recv_response'
        from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:552:in `block in do_start'
        from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:939:in `critical'
        from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:552:in `do_start'
        from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:519:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'

help docs表示使用端口465和SSL认证.我试过有和没有:enable_starttls_auto =>真的,但它仍然超时.

具体来说,docs指定以下设置:

>     Email Address: Username@yourdomain.com
>     User Name format: Username@yourdomain.com
>     Secure Connection (SSL)   Yes
>     Outgoing Mail Server Name: smtp.zoho.com
>     Outgoing Port No.: 465
>     Outgoing Mail Server requires authentication: Yes

有任何想法吗?

附:我已将Outlook配置为使用help docs中的设置,并且外发电子邮件工作正常. telnet到smtp.zoho.com 465也连接.

解决方法

# Action Mailer
ActionMailer::Base.delivery_method = :smtp  
ActionMailer::Base.smtp_settings = {            
  :address              => "smtp.zoho.com",:user_name            => 'someone@somewhere.com',:password             => 'password',:authentication       => :login,:ssl                  => true,:tls                  => true,:enable_starttls_auto => true    
}

这对我有用您的设置可能很好,一些本地网络会阻止这些数据包.我必须通过我的3G网络进行测试.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读