2011-04-29 69 views
5

应该如何设置我的SMTP设置在我的初始化文件中使用GoDaddy的邮件?SMTP设置3

+1

你要求的godaddy的SMTP设置?或者如何在Rails应用中设置它们? – thekindofme 2011-04-29 06:41:52

+0

both ............. – user730569 2011-04-29 06:44:37

回答

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’ 
} 

对于GoDaddy的,加上下面几行 -

ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = { 
:address => ‘smtpout.secureserver.net’, 
:domain => ‘www.example.com’, 
:port  => 80, 
:user_name => ‘[email protected]’, 
:password => ‘yourpassword’, 
:authentication => :plain 
} 

保存并重启你的网络服务器。你一切都准备好了。

请记住,你只能每天发送300个邮件从GoDaddy的,所以如果你需要发送更多的电子邮件,你将不得不使用sendmail或一些其他的解决方案。

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

+1

注意 - 它应该是ActionMailer :: Base.smtp_settings – ch3rryc0ke 2012-03-22 23:31:54

+0

非常好的一点 - 看起来像server_settings在5年前被弃用并被smtp_settings取代。我的错。 – 2012-03-23 16:40:47

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 => '[email protected]', 
    :password => 'yourpassword', 
    :authentication => :plain 
}