0

我正在关注 RailsApps 项目中的Learn Ruby on Rails一书。在第 23 章中,我们将发送邮件功能添加到应用程序中。一切似乎都工作正常,期望我收到的电子邮件来自我自己的电子邮件(不管我在联系表格中输入的电子邮件)。

这很奇怪,因为在服务器日志中,“发件人”似乎没问题。但是,当我在线查看我的电子邮件 (gmail) 时,它看起来好像我既是发件人又是收件人。

以下是来自服务器日志的代码:

Started POST "/contacts" for ::1 at 2015-03-02 14:06:09 -0500
Processing by ContactsController#create as HTML
Parameters: {"utf8"=>"✓",     "authenticity_token"=>"XRDoCx9oADWIWAKWRGgmQSaWaN0HLa8JywAsaNS/4N1YPlME9Z2gtEk6hQikwwrLWPDOtNoL9NfABUO2PGOYwQ==", "contact"=>{"name"=>"John Doe", "email"=>"j.doe@jd.com", "content"=>"Hello world!"}, "commit"=>"Submit"}

WARNING: GoogleDriveV0.login is deprecated and will be removed in the next version. Use GoogleDriveV0.login_with_oauth instead.

DEPRECATION WARNING: `#deliver` is deprecated and will be removed in Rails 5. Use `#deliver_now` to deliver immediately or `#deliver_later` to deliver through Active Job. (called from create at /Users/SergioRodriguez/workspace/learn-rails/app/controllers/contacts_controller.rb:17)
Rendered user_mailer/contact_email.html.erb (0.1ms)
Rendered user_mailer/contact_email.text.erb (0.1ms)

UserMailer#contact_email: processed outbound mail in 37.5ms

Sent mail to my.email@gmail.com (2314.6ms)
Date: Mon, 02 Mar 2015 14:08:03 -0500
From: j.doe@jd.com
To: my.email@gmail.com

知道发生了什么吗?

4

1 回答 1

0

查看答案:在c#中通过gmail发送邮件时更改发件人地址

Gmail 不允许您将 FROM 更改为与您的 gmail 帐户不同的内容。

无论您使用什么,他们都会在转发之前覆盖它。这可以防止垃圾邮件/欺骗。

于 2015-03-04T13:36:49.013 回答