Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Devise sender name for email

Although this thread doesn't say much, I figured you set the sender name in the Devise intializer like this:

app/config/initializers/devise.rb

Devise.setup do |config|
  config.mailer_sender = "'MySite' <[email protected]>"
end

But this didn't work for me.

Does anyone know the correct way to do this?

like image 385
LearningRoR Avatar asked Mar 15 '12 01:03

LearningRoR


3 Answers

This is it:

config.mailer_sender = '"Example.com" <[email protected]>'
like image 148
LearningRoR Avatar answered Nov 04 '22 14:11

LearningRoR


You can also use escaped characters like this:

config.mailer_sender = "\"Support Desk\" <[email protected]>"
like image 20
max kaplan Avatar answered Nov 04 '22 14:11

max kaplan


If you need to do this for devise, heroku and mandrill: and you're setting the email address as an environment variable you'll need to do it like so (I found out the hard way when the above email format above broke our sign up process, let my pain be your gain :)

Label:  Value:
EMAIL   Example.com <[email protected]>

No ' or " required.

like image 1
GhostFaceCoder Avatar answered Nov 04 '22 16:11

GhostFaceCoder