Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

actionmailer "from" setting

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

default :from => "[email protected]"

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

}

like image 631
mtay Avatar asked Apr 01 '26 01:04

mtay


1 Answers

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

like image 81
Dylan Markow Avatar answered Apr 03 '26 17:04

Dylan Markow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!