在轨道上使用ruby不发送电子邮件

时间:2014-03-27 14:07:24

标签: ruby-on-rails actionmailer

它在控制台中写了邮件已发送但我无法在收件箱中找到任何内容。

    Sent mail to abo_salah_2010@hotmail.com (5.2ms)
Date: Thu, 27 Mar 2014 15:53:51 +0200
To: abo_salah_2010@hotmail.com
Message-ID: <53342d6f7e8_12f7c8dfe832535@salah-Dell-System-XPS-L502X.mail>
Subject: Request Accepted by the Carrier
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

NewsletterMailer#weekly

Hi, find me in app/views/app/views/newsletter_mailer/weekly.text.erb

=> #<Mail::Message:32171900, Multipart: false, Headers: <Date: Thu, 27 Mar 2014 15:53:51 +0200>, <To: abo_salah_2010@hotmail.com>, <Message-ID: <53342d6f7e8_12f7c8dfe832535@salah-Dell-System-XPS-L502X.mail>>, <Subject: Request Accepted by the Carrier>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>
irb(main):002:0> 

以下是配置:

    ShipmeProj::Application.configure do
  config.action_mailer.default_url_options = { host: "localhost:3000" }
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "localhost:3000",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: ENV["xxxxx@gmail.com"],
  password: ENV["xxxxx"]

1 个答案:

答案 0 :(得分:1)

您错过了配置:

config.action_mailer.perform_deliveries = true