从Dev环境发送的邮件,但不是测试环境 - Rails

时间:2013-03-01 21:04:11

标签: ruby-on-rails email gmail

我有一个允许用户请求注册活动的应用程序。当提交邀请请求时,控制器执行以下代码:

EventMailer.notify_admins(@user, subject, topic).deliver

该应用程序运行良好(开发,测试和生产),但几周前,通过测试和生产环境填写的邀请请求已停止向管理员发送电子邮件。它仍然可以从开发环境中正常工作。当我检查测试环境日志文件时,我在其中看到以下内容:

Rendered event_mailer/notify_admins.html.erb (1.3ms)        
Rendered event_mailer/notify_admins.text.erb (1.0ms)        

Sent mail to xxxx@xxxxx.com (1529ms)        
Date: Fri, 01 Mar 2013 20:45:00 +0000        
From: xxxx@xxxxxxx.com        
To: xxxx@xxxxx.com        
Message-ID: <5131134cdd3aa_3cf96d18707060@xxxx-test.mail>        
Subject: Invite request received from: John Doe        
Mime-Version: 1.0        
Content-Type: multipart/alternative;        
boundary="--==_mimepart_5131134cc6832_3cf96d1870674a";        
charset=UTF-8        
Content-Transfer-Encoding: 7bit        



----==_mimepart_5131134cc6832_3cf96d1870674a        
Date: Fri, 01 Mar 2013 20:45:00 +0000        
Mime-Version: 1.0        
Content-Type: text/plain;        
 charset=UTF-8        
Content-Transfer-Encoding: 7bit        
Content-ID: <5131134cd7f78_3cf96d18706818@xxxx-test.mail>        

Invite request received from:         

First Name: John        
Last Name: Doe        
Email Address: john_doe@xxxx.com        

http://test.xxxxx.com/users/109/edit        



----==_mimepart_5131134cc6832_3cf96d1870674a        
Date: Fri, 01 Mar 2 013 20:45:00 +0000        
Mime-Version: 1.0        
Content-Type: text/html;        
 charset=UTF-8        
Content-Transfer-Encoding: 7bit        
Content-ID: <5131134cdb33d_3cf96d187069bd@dent-test.mail>        

<p>Invite request received from: </p>        

<p>First Name: John </p>        
<p>Last Name: Doe </p>        
<p>Email Address: john_doe@xxxxx.com </p>        

http://test.xxxx.com/users/109/edit        

<a href=""> Click here to manage request </a>        


----==_mimepart_5131134cc6832_3cf96d1870674a--        

Redirected to http://test.xxxxx.com/        
Completed 302 Found in 3343ms (ActiveRecord: 99.8ms)        

...但是没有收到电子邮件,当我查看邮件日志(发送的电子邮件,Google邮件)时,我在发送的文件夹中看不到任何内容(尽管它在我在开发环境中)

我使用Google应用作为我的邮件服务器,开发/测试/制作上的代码完全相同。为了确保没有缓存资源,我还在测试和生产中预编译资产并重新启动Apache服务器。有什么想法吗?

的环境

测试,开发和生产环境smtp设置部分是相同的:

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"

config.action_mailer.smtp_settings = {
    address: "smtp.gmail.com",
    port: 587,
    domain: "xxxxxxx.com",
    authentication: "plain",
    enable_starttls_auto: true,
    user_name: ENV["MY_EMAIL_FROM"],
    password: ENV["MY_EMAIL_FROM_PWD"]

}

当我在TEST和PRODUCTION上将config.action_mailer.raise_delivery_errors设置为TRUE时,出现500错误。如果设置为false,则电子邮件根本不会被发送。

0 个答案:

没有答案