【问题标题】:Rails 2.3: SMTP settings for Postmarkapp: Connection refused - connect(2)Rails 2.3:Postmarkapp 的 SMTP 设置:连接被拒绝 - 连接(2)
【发布时间】:2012-01-06 05:59:26
【问题描述】:

有人有使用 Postmarkapp 的经验吗?

我有一个 rails 2 应用程序(radiant cms)并尝试通过 SMTP 发送电子邮件。

这是我的 smtp 设置的样子:

config.action_mailer.smtp_settings = {
  :address        => "smtp.postmarkapp.com",
  :port           => '25',
  :authentication => :plain,
  :user_name      => 'postmark-ap-key',
  :password       => 'postmark-ap-key',
  :domain => 'postmarkapp.com'
}

Mailer 类:

class RegistrationMailer < ActionMailer::Base

  def send_email(email, sent_at = Time.now)
    subject "Some text here"
    recipients "#{email}"
    from 'xxx@yxz.com'
    sent_on sent_at
    body :text => "Some text here"
  end

end

这是我调用deliver方法的代码(在控制器动作中):

mail = RegistrationMailer.create_send_email(params[:email])
RegistrationMailer.deliver(mail)

每当我调用交付方法时,都会收到“连接被拒绝 - connect(2)”错误。任何人都可以帮助我解决我做错了什么?我在 heroku 上使用了完全相同的代码和其他 smtp 设置(用于 sendgrid),它没有任何问题。

【问题讨论】:

    标签: ruby-on-rails smtp postmark


    【解决方案1】:

    我自己没有使用 Postmark,但似乎有一个 gem 可以帮助您通过他们的系统发送邮件,这可能是因为您必须通过 API 密钥发送。

    https://github.com/wildbit/postmark-rails

    http://rubygems.org/gems/postmark-rails

    实施相关问题:How can I customize Devise to send password reset emails using PostMark mailer

    【讨论】:

    • 也许拒绝连接到端口 25 是由防火墙或 ISP 阻塞端口 25 引起的完全不相关的问题。
    • 出于这个原因,PostMark 还提供了 2525 端口。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-23
    • 1970-01-01
    • 2015-07-06
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多