【问题标题】:ActionMailer and Gmails setup Rails 3.0.1/3.1.0ActionMailer 和 Gmails 设置 Rails 3.0.1/3.1.0
【发布时间】:2012-08-14 23:34:04
【问题描述】:

我一直在尝试使用我的 rails 应用程序设置 ActionMailer,但没有成功。我已经搜索了几个不同的线程,但没有找到解决方案。我需要安装某种 gem 来防止我的问题吗?

问题来了:

https://gist.github.com/3341261

==解决方案==

所以我的解决方案是使用 tlsmail gem。我关注了这个帖子,那里的第二个答案帮助我解决了我的问题。

gmail smtp with rails 3

关于独角兽有一个陷阱。我正在使用 init.d 文件重新启动服务器,但是我必须实际停止服务器,然后手动删除 pid 文件以用于独角兽。启动独角兽后,它起作用了。

【问题讨论】:

  • 3.0.10是rails的版本。
  • 你的 Ruby 版本是什么? Ruby 1.8.6 没有 starttls。远射。
  • ruby 1.9.3p125(2012-02-16 修订版 34643)[x86_64-linux]
  • 嗯,认为你应该按照 Amar 的建议尝试,一个 tlsmail gem。

标签: ruby-on-rails ruby actionmailer


【解决方案1】:

以下是我的有效设置之一。希望它可以帮助您发现错误的地方。 =)

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
        :address              => "smtp.gmail.com",
        :port                 => 587,
        :domain               => 'mobileme.com',
        :user_name            => 'hello@mobileme.com',
        :password             => 'Z!DDq%a!OsfGCsdsd2mEc',
        :authentication       => 'plain',
        :enable_starttls_auto => true  
    }

当然,我更改了域和密码。

【讨论】:

  • 这是我目前无法使用的设置...与“starttls must first issue..”相同的错误 ActionMailer::Base.smtp_settings = { :address => "smtp.gmail. com", :port => 587, :domain => "domain.com", :user_name => "bot", :password => 'passwordF', :authentication => "plain", :enable_starttls_auto => true }
【解决方案2】:

试试 :enable_starttls_auto => true 动作邮件配置中的选项

【讨论】:

  • 我已尝试启用此功能,但仍然出现上述相同的错误。
  • 我已经通过这个答案安装了 tlsmail gem,但是我收到一个错误,说它找不到文件......奇怪的是它有一个 7:stackoverflow.com/questions/6379950/gmail-smtp-with-rails-3 当我运行 bundle list 它出现...
  • 更新...我使用 rails server webbrick 运行它,它似乎可以工作,但是当我尝试使用 unicorn 启动它时,它无法加载到 gem 中。
【解决方案3】:

所以我的解决方案是使用 tlsmail gem。我关注了这个帖子,那里的第二个答案帮助我解决了我的问题。

带有rails 3的gmail smtp

关于独角兽有一个陷阱。我正在使用 init.d 文件重新启动服务器,但是我必须实际停止服务器,然后手动删除 pid 文件以用于独角兽。启动独角兽后,它起作用了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-03
    • 1970-01-01
    • 2011-07-22
    • 1970-01-01
    • 2011-11-27
    • 2011-08-12
    • 1970-01-01
    • 2013-02-20
    相关资源
    最近更新 更多