swiftmailer | Change the To: header

6 posts by 2 authors in: Forums > CMS Builder
Last Post: October 19, 2015   (RSS)

By ht1080z - October 15, 2015

Hi,

How can i set the name of the sender in the swiftMailer globally?

->setFrom(array('no-reply@email.com'=>'Example sender'))

there is an option in the documentation but i cannot manage to change the common.php swiftmailer part to do it.

I need to set this with the same sender name for all mails with mail templates that send from my system.

Please help,
Karls

By ht1080z - October 16, 2015

Hi Dave,

I don't understand, please clear this for me better.

(I want to change the default sender email to sender name everywhere.)

Can i set the "From" in the email template to a desired name and not set this with email?

Thank you,
Karls

By Dave - October 19, 2015

Hi Karls,

There's no functionality in CMSB to change the "From" email address in every email template all at once.

You could do that by hacking the code, but then you'd have to redo that change every time you upgrade.  Also, it would break the functionality of plugins and email templates that expect the "From" address in the email template to work.

The way to edit the from address (or any other field) is to access the email template from the menu, eg: Admin > Email Templates > USER-PASSWORD-RESET > modify

And then change "From" to the email address you want to use or #settings.adminEmail# to use the email address in "Admin > General".

Alternatively, if you had many many email templates, and you were comfortable with MySQL, you could write a MySQL query to update all the from: fields at once.  Or you could even write a plugin to "Globally Set From" with a single field that performed that query.  

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By ht1080z - October 19, 2015

Hi Dave,

Thank you for your reply..

My question is really just try to clarify if i can use any name instead of email address in the mail templates From fields.

It is not a problem for me to change one by one after that.

Karls

By Dave - October 19, 2015

Hi Karls, 

Ok, sorry I misunderstood!  You can use this format when entering emails under "Email Templates" or for "Admin Email" under Admin > General

Dave Edis <dave@interactivetools.com>

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com