craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 627 forks source link

[4.x]: Can't map SMTP email encryption method to .env variable #11826

Closed realjoshharrison closed 2 years ago

realjoshharrison commented 2 years ago

What happened?

Description

.env variables not available to select in the dropdown in Craft / Settings / Email / SMTP transport.

Steps to reproduce

  1. Create .env variable e.g. SMTP_ENCRYPTION=TLS
  2. In Craft > Settings > Email > Set the email transport to SMTP
  3. Click Encryption Method dropdown to select $SMTP_ENCRYPTION, no env vars are in the list
  4. Try to enter $SMTP_ENCRYPTION as the Encryption Method, it clears itself on blur

Expected behavior

The dropdown shows suitable env vars, like the 'Use authentication' dropdown does above.

Actual behavior

No env vars are available to select or enter.

Thanks as always for looking into it!

Craft CMS version

4.2.2

PHP version

8.0.8

Operating system and version

MAMP Pro, Darwin 21.6.0, Apache 2.4.48 (MacOS 12.5)

Database type and version

MySQL 5.7.34

Image driver and version

ImageMagick 6.9.6-2

Installed plugins and versions

"craftcms/contact-form": "3.0.0",
"craftcms/contact-form-honeypot": "2.0.0",
"craftcms/redactor": "3.0.2",
"vlucas/phpdotenv": "^5.4.0"

realjoshharrison commented 2 years ago

Doh. Didn't realise the env var value had to be lowercase for it to be filtered out as a valid option.

Using SMTP_ENCRYPTION=tls and it's sorted.