Is there a way to set the system email address and sender name from within the config file?

This would be useful when using multi environment configurations. For instance, during development or on my staging server I wish emails to be sent to me (the developer). While for production they would go to the site owner.

I can see the values in serialised data within the database but was hoping I could override them within the config file. I've tried the keys "emailAddress" and "senderName" to no avail.

up vote 3 down vote accepted

The testToEmailAddress config setting which

Configures Craft to send all system emails to a single email address (or multiple email addresses), for testing purposes.

sounds like the one you are looking for.

Marion's answer is a workaround for Craft 2, but this has been officially addressed in the upcoming Craft 3: https://github.com/craftcms/cms/issues/840

  • This feedback 404s. Is this possible yet in the config? It would be a great feature. – ianp Jul 11 '17 at 13:34
  • Updated answer. – Brad Bell Jul 12 '17 at 0:10

Shameless plug: We've written a plugin that automatically updates your email settings depending on your environment. It's not free, but it is cheap :-) Please check out the page on our website for more information.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.