使用 ActionMailer 通过我的 Rails 应用程序发送电子邮件时,尽管指定了 'from:' 参数,我还是收到了自己发来的电子邮件
When sending an email through my Rails app using ActionMailer I get the email from myself despite of specifying the 'from:' argument
我正在关注 RailsApps 项目的 Learn Ruby on Rails 一本书。在第 23 章中,我们向应用程序添加了发送邮件功能。一切似乎都正常,但我收到的电子邮件来自我自己的电子邮件(无论我在联系表中输入的电子邮件是什么)。
很奇怪,因为在服务器日志中,"sender" 似乎没问题。但是,当我在线查看我的电子邮件 (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
知道发生了什么吗?
查看答案:change sender address when sending mail through gmail in c#
Gmail doesn't allow you to change the FROM to something different than
your gmail account.
It doesn't matter what you use, they over-write it, before they relay
it on. This prevent spamming/spoofing.
我正在关注 RailsApps 项目的 Learn Ruby on Rails 一本书。在第 23 章中,我们向应用程序添加了发送邮件功能。一切似乎都正常,但我收到的电子邮件来自我自己的电子邮件(无论我在联系表中输入的电子邮件是什么)。
很奇怪,因为在服务器日志中,"sender" 似乎没问题。但是,当我在线查看我的电子邮件 (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
知道发生了什么吗?
查看答案:change sender address when sending mail through gmail in c#
Gmail doesn't allow you to change the FROM to something different than your gmail account.
It doesn't matter what you use, they over-write it, before they relay it on. This prevent spamming/spoofing.