我正在尝试设置设计1.3.4,以便在开发模式下通过Gmail发送电子邮件.我应该提一下,我使用的是Rails 3.0.4和
Ruby 1.9.2p136.
我在config / environments / development.rb中尝试了以下内容:
config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_deliveries = true config.action_mailer.default_url_options = { :host => 'mydomain.com' } ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com",:port => 587,:domain => "mydomain.com",:user_name => "info",:password => "secret",:authentication => "plain",:enable_starttls_auto => true }
在config / initializers / devise.rb中我改变了
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
至
config.mailer_sender = "info@mydomain.com"
然后我试了一下
http://yekmer.posterous.com/devise-gmail-smtp-configuration
它仍然无法正常工作.
是否有关于如何让邮件工作的维基页面?我在日志中看到了电子邮件,看起来很棒!链接工作等…我只想在我的电子邮件帐户中看到它们.
编辑
我找到了答案 –
我使用了http://yekmer.posterous.com/devise-gmail-smtp-configuration – 当我将它放在config / environments / development.rb中时,我一直把这些代码放在config / intializers / devise.rb中.
解决方法
你试过这个吗?
config.action_mailer.default_url_options = { :host => 'localhost:3000' } ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com",:domain => "gmail.com",:user_name => "myinfo@gmail.com",:authentication => "plain" # :enable_starttls_auto => true # I don't have this,but it should work anyway }
———编辑
class UserMailer < ActionMailer::Base default :from => "myinfo@gmail.com" # ... end