使用Godaddy邮件与Rails 3的SMTP设置

use*_*569 5 ruby ruby-on-rails actionmailer ruby-on-rails-3

如何使用Godaddy邮件在我的初始化程序文件中设置我的SMTP设置?

Dan*_*rza 11

无耻地从这篇文章中摘录:http://pilotoutlook.wordpress.com/2008/10/13/setup-email-in-ruby-on-rails-using-godaddysmtp/

打开ROOT/config/environment.rb文件对于sendmail,添加以下行 -

ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.smtp_settings = {
:domain  => ‘www.example.com’
}
Run Code Online (Sandbox Code Playgroud)

对于Godaddy,添加以下行 -

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => ‘smtpout.secureserver.net’,
:domain  => ‘www.example.com’,
:port      => 80,
:user_name => ‘johndoe@example.com’,
:password => ‘yourpassword’,
:authentication => :plain
}
Run Code Online (Sandbox Code Playgroud)

保存并重新启动您的Web服务器.你们都准备好了.

请记住,您每天只能从Godaddy发送300封电子邮件,因此如果您需要发送更多电子邮件,则必须使用sendmail或其他解决方案.

请注意,端口未设置为25 - 这是故意的.GoDaddy的电子邮件服务器配置为使用多个端口,以防25被阻止.


gro*_*ser 5

# config/environments/production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => 'smtpout.secureserver.net',
  :domain  => 'www.example.com',
  :port      => 80,
  :user_name => 'johndoe@example.com',
  :password => 'yourpassword',
  :authentication => :plain
}
Run Code Online (Sandbox Code Playgroud)