Pretty straight forward here, I'd like to use MailTrap for devMode and then use an SMTP service (Mandrill or like) for production. I looked through the General Config Settings docs but didn't see anything that lent itself to being SMTP related. Is this possible?

  • 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.
    – Gaz
    Commented Aug 2, 2017 at 20:35

2 Answers 2


Not an easy way to do this in Craft 2, but this is possible in the upcomgin Craft 3 (currently in beta) using craft/config/app.php, which is multi-environment aware.


If you're running Craft 3.7.22 or later, all SMTP-related email settings (except "Timeout") support environment variables.

Most SMTP related settings received environment variable support in Craft 3.1.0, excluding "Use authentication" and "Encryption Method" which only supports environment variables since Craft 3.7.22.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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