使用bluehost的Rails Actionmailer配置

时间:2013-03-05 17:36:53

标签: ruby-on-rails-3.2 actionmailer bluehost

我正在使用rails 3.2.11并使用蓝色主机作为发送电子邮件的电子邮件服务器。

下面的

是我在development.rb中的配置信息

   config.action_mailer.smtp_settings = {

    :address              => "box75112.bluehost.com",

    :port                 => "465",
    :domain               => "bluehost.com",

    :enable_starttls_auto => true,
    :authentication       => :login,
    :user_name            => "support@buddy.io",
    :password             => "93utitrpppJvZ,[#4rl4"

}

这些是我的蓝色主持人信息

      Mail Server Username: support+buddy.io
      Incoming Mail Server: mail.buddy.io
      Incoming Mail Server: (SSL) box75112.bluehost.com
      Outgoing Mail Server: mail.buddy.io (server requires authentication) port 26
      Outgoing Mail Server: (SSL) box75112.bluehost.com (server requires authentication) port 465

      Supported Incoming Mail Protocols: POP3, POP3S (SSL/TLS), IMAP, IMAPS (SSL/TLS)
      Supported Outgoing Mail Protocols: SMTP, SMTPS (SSL/TLS) 

但不发送电子邮件,也没有错误

有人可以帮忙吗?

由于

2 个答案:

答案 0 :(得分:1)

我使用ActionMailer成功使用与BlueHost SMTP服务器的非加密连接:

config.action_mailer.smtp_settings = {
    address:              => "mail.buddy.io",
    port:                 => 26,
    enable_starttls_auto: => false,
    authentication:       => "plain",
    user_name:            => "support+buddy.io",
    password:             => "password"
}

请注意,user_name与电子邮件地址不同。并且不需要domain参数。

答案 1 :(得分:0)

如果还是派上用场的话。您可以使用ssl,尝试这样的事情:

 config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { :host => 'example.com' }
  config.action_mailer.raise_delivery_errors = true
  # Send email in development mode?
  config.action_mailer.perform_deliveries = true

  config.action_mailer.smtp_settings = {
      address: "server.example.com",
      port: 465,
      enable_starttls_auto: true,
      ssl: true,
      domain: 'example.com',
      user_name: 'user@example.com',
      password: 'MyPassWorD',
      authentication: :plain
  }

在Bluehost上为我工作。