2011-11-25 96 views
1

有没有人有Postmarkapp的经验?Rails 2.3:Postmarkapp的SMTP设置:拒绝连接 - connect(2)

我有一个rails 2应用程序(辐射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' 
} 

的梅勒类:

class RegistrationMailer < ActionMailer::Base 

    def send_email(email, sent_at = Time.now) 
    subject "Some text here" 
    recipients "#{email}" 
    from '[email protected]' 
    sent_on sent_at 
    body :text => "Some text here" 
    end 

end 

和这里就是我所说的交付方法(在控制器的行动)的代码:

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

无论何时我调用递送方法,我都会收到'连接被拒绝 - 连接(2)'错误。任何人都可以帮我解决我做错了什么?我在heroku上使用了与其他smtp设置完全相同的代码(用于sendgrid),并且没有任何问题。

回答

0

我还没有使用邮戳自己,但似乎有一个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

+0

也许到25端口被拒绝的连接是由防火墙或端口的ISP封锁25 –

+0

有一个完全不相关的问题由于这个原因,PostMark也提供了2525端口。 – mahemoff