动作邮件发件人“来自”设置 [英] actionmailer "from" setting

查看:103
本文介绍了动作邮件发件人“来自”设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ActionMailer,在我的邮件模型中,我有一个类似这样的from集合

I am using ActionMailer and in my mailer model, I have a from set like this

default :from => "from@example.org"

在我的environment.rb中,我有一个不同的用户名

In my environment.rb, I have a different username within

ActionMailer::Base.smtp_settings = {}

,但我希望使用发件人地址覆盖它。.以便用户只能看到。这可能吗?另外,当我在environment.rb中更改设置时,我看不到更改发生了...我是否需要重新启动Rails服务器以刷新这些设置?

but I'd like the from address to override this.. so that the user sees only that. Is this possible? Additionally, when I change my settings within environment.rb, I don't see my changes take place... do I need to restart my rails server to refresh these settings?

===
这是我的一些设置:

=== here are some of my settings:

ActionMailer::Base.smtp_settings = {
:tls => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => '==.org',
:authentication => :plain,
:user_name => '===',
:password => '==='

}

推荐答案

Gmail不允许您以其他用户的身份发送-它将始终使用您用于登录的帐户的发件人地址(这是为了防止安全/垃圾邮件相信,这样您就无法欺骗他人的地址。)

Gmail doesn't let you send as a different user -- it will always make the "From" address the account you're using to sign on (this is for security/spam prevention I believe, that way you can't spoof someone else's address).

假设您拥有要发送的电子邮件地址,那么有一种方法可以解决您的Google帐户,以允许从这些电子邮件地址发送邮件。进入Gmail选项,单击帐户部分,然后单击添加您拥有的另一个电子邮件地址。

Assuming you own the e-mail address(es) you want to send from, there's a way through your Google account to allow sending from those e-mail address(es). Go into the Gmail options, click the "Accounts" section, and click "Add another e-mail address you own."

这篇关于动作邮件发件人“来自”设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆