客户的网站在 Rails 3 中构建并托管在 Heroku 上,并接受通过 rails 邮件发送的表单提交。他们正在接收重复的电子邮件。我无法在我的开发环境中复制该问题。
邮件通过使用标准 Rails 邮件程序注册到其域的 gmail 帐户发送:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "clientdomain.com",
:user_name => "noreply@clientdomain.com",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}
和
(gather data)
mail(:to => "staff@clientdomain.com", :subject => "Form Submittal", :from => @email)
副本不一定会立即发送,因为它们的交付时间会在原件后 1 分钟到 3 小时不等。
在某些情况下,HTML 字符会替换为实体。
这是一个例子:
From: noreply@clientdomain.com
> Subject: Form Submittal
> Date: December 14, 2012 10:38:18 PM EST
> To: staff@clientdomain.com
>=20
> Form Submittal
>=20
> Name: Potential Lead
>=20
> Phone: 1234567890
>=20
> Email: some.user@gmail.com
>=20
> Message: Hi my names Some I'm from tennesse and I'd really like to =
> get info on your service thank you for all your help!!!
>=20
并复制:
> From: noreply@clientdomain.com
> Subject: Form Submittal
> Date: December 15, 2012 1:46:54 AM EST
> To: staff@clientdomain.com
>=20
> Form Submittal
>=20
> Name: Potential Lead
>=20
> Phone: 1234567890
>=20
> Email: some.user@gmail.com
>=20
> Message: Hi my names Some I%27m from tennesse and I%27d really like =
> to get info on your service thank you for all your help%21%21%21
>=20
我很想认为表单只是被提交了两次,但是在 3 小时后提交完全相同的输入的可能性不大,再加上大量的欺骗(有时报告 60-75%,但从来没有 100%)让我高度对此表示怀疑。
我还发现了一个关于重复问题的要点,它指示我用这个覆盖默认设置:
config.action_mailer.sendmail_settings = {
:arguments => '-i'
}
...没有有益的结果。
我的问题,如果不是很明显:如何阻止 rails 发送重复的电子邮件?