简体   繁体   中英

MailCatcher is not sending emails

I'm using MailCatcher with Rails, but is is not working. On rails console, I did:

> Signup.confirm_email(User.second).deliver

And I got that:

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

But nothing appears at localhost:1080 and at my email.

Here is a print of my files and folders: http://imgur.com/udxkhYj

And code:

mailers/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

config/environment/development.rb

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

What should I do?

Well, the problem was the eventmachine 1.0.4. I installed 1.0.3 and it now works :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM