MailCatcher不发送电子邮件

时间:2015-01-05 03:10:59

标签: ruby-on-rails sendmail mailcatcher

我正在使用带有Rails的MailCatcher,但是无法正常工作。 在rails控制台上,我做了:

> Signup.confirm_email(User.second).deliver

我明白了:

Rendered signup/confirm_email.html.erb (2.2ms)
Rendered signup/confirm_email.text.erb (0.6ms)

Signup#confirm_email: processed outbound mail in 246.1ms

Sent mail to hi@example.com (7.0ms)
Date: Mon, 05 Jan 2015 00:55:03 -0200
From: no-reply@hello.com
To: hi@example.com
Message-ID: <54a9fd0740a1c_18f1115f968218f9@Leonardo.mail>
Subject: Confirm your email :)
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_54a9fd073f97f_18f1115f96821751";
charset=UTF-8
Content-Transfer-Encoding: 7bit

但是localhost:1080和我的电子邮件都没有出现。

这是我的文件和文件夹的打印: http://imgur.com/udxkhYj

代码:

寄件人/ signup.rb

class Signup < ActionMailer::Base
default from: 'no-reply@hello.com'

def confirm_email(user)
    @user = user

    @confirmation_link = root_url

    mail({
        :to => user.email,
        :bcc => ['sign ups <signups@hello.com>'],
        :subject => I18n.t('signup.confirm_email.subject')
    })
end
end

配置/环境/ development.rb

Rails.application.configure do
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
end

我该怎么办?

1 个答案:

答案 0 :(得分:1)

嗯,问题是eventmachine 1.0.4。我安装了1.0.3,它现在可用了:)