Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
583 views
in Technique[技术] by (71.8m points)

ruby on rails - actionmailer "from" setting

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

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

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

ActionMailer::Base.smtp_settings = {}

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 => '==='

}

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).

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."


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...