Forum: Ruby on Rails How to set Sender Name in the From: header in Action Mailer

F1fc505affedce69121309c9b8f2ba10?d=identicon&s=25 Hari Rajagopal (harizen)
on 2008-05-09 19:56
I have setup ActionMailer to send mails via Gmail.

Here are the settings:

config.action_mailer.smtp_settings =  {
:address => "smtp.gmail.com",
:port    => "587",
:domain => "example.com",
:authentication => :plain,
:user_name => "admin@example.com",
:password => "secret"
}
The "admin" username has an email account setup with a name of "Mailer
Account"

How do I set the From: header so that the user's inbox shows the name on
the account that the mail is sent from instead of the username "admin"
that shows up currently.

How do I get this to happen?

Thanks in advance
Aaa01cead25315295d1bb0aebf21e6dc?d=identicon&s=25 kopf1988 (Guest)
on 2008-05-09 20:12
(Received via mailing list)
I think I did something like

From "Master Chief <master_cheif@hotmail.com"

It was very similar to that and it worked.

On May 9, 12:56 pm, Hari Rajagopal <rails-mailing-l...@andreas-s.net>
F1fc505affedce69121309c9b8f2ba10?d=identicon&s=25 Hari Rajagopal (harizen)
on 2008-05-09 20:57
kopf1988 wrote:
> I think I did something like
>
> From "Master Chief <master_cheif@hotmail.com"
>
> It was very similar to that and it worked.
>
> On May 9, 12:56 pm, Hari Rajagopal <rails-mailing-l...@andreas-s.net>

I tried in the smtp settings

:user_name => "Mailer Account <admin@example.com>",

and it didn't work
61f9a215dc708b46dc580ce0e1af513f?d=identicon&s=25 Kyle (Guest)
on 2008-05-11 01:38
(Received via mailing list)
Gmail does not let you alter the "from" email address when relaying.
You can specify the "from" name in your mailer, but it will use the
"from" address for the credentials that you supply to log into your
account.  I wanted emails to come from "My Company
<webmaster@mycompany.com>", but our webmaster account is a nickname
for my account, so it does not have its own login credentials.  Since
I had to use my account information to log in, when I send an email,
it will say "My Company <myaccountname@mycompany.com>" in the "from"
field.

If you're not using Gmail, specifying "from" in the mailer works fine.

-Kyle

On May 9, 1:57 pm, Hari Rajagopal <rails-mailing-l...@andreas-s.net>
Bc572b4652b1df3ea13619423acd6127?d=identicon&s=25 Nimesh Nikum (nimeshnikum)
on 2011-01-05 12:47
I changed delivery method to :sendmail and it started to work for me :-)

ActionMailer::Base.delivery_method = :sendmail

I hope it helps to you also :-)
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.