The official Craft documentation says it is possible to set the "Encryption Method (SMTP)" , Snipped from the documentation, with an Environment Variable.

I think i am missing something but i cant seem to find the exact .env Variable Name Craft is expecting for this setting.

2 Answers 2


You can name the environment variable whatever you want. The trick is that the variable's value needs to be either none, ssl or tls (i.e. the three options that are supported for the "Encryption Method" setting), for it to be selectable for that setting.

For example, if you add a variable called SMTP_ENCRYPTION_METHOD to your .env file, and set its value to ssl (i.e. SMTP_ENCRYPTION_METHOD=ssl), that variable will show up as a selectable option for the "Encryption Method" setting:

enter image description here

Note that the "Use authentication" setting has the same behaviour; any and all environment variables with a value set to one of these settings' supported options (yes, no, true, false, on, off, 0 or 1, for the "Use authentication" setting) will be selectable, regardless of the actual variable name.

Edit: Environment variable support for the Encryption Method setting was only added in Craft 3.7.22, so make sure you're on at least that version.

  • Where can one find all the possible environment variables related to SMTP in craft?
    – BrokenCode
    Commented Dec 14, 2022 at 16:23
  • @BrokenCode Anything in particular you're looking for? There aren't any dedicated environment variables related to SMTP per se; only environment variable support for most of the SMTP settings. The actual environment variables can be named anything. Commented Dec 14, 2022 at 16:56

In the CP, I don't think that's an option. The name of the variable is encryptionMethod and its value comes from database (encryptionMethod). It doesn't have an accessible value from your .env file.

In your PHP code yes you can do that. You will just have to use Craft::parseEnv($yourVariable);

  • 1
    It was added quite recently in Craft 3.7.22 :) Commented Dec 22, 2021 at 23:09
  • 1
    No wonder! I guess I need to update. Dev is running 3.6.18. And thank you for that! Commented Dec 22, 2021 at 23:10
  • 1
    Added a note about that to the my answer, since it's so recent – OP might be on an older version, too :) Commented Dec 22, 2021 at 23:14

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.