From c483e0768f046b9d7836a2e36e461a042f9ebb22 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 7 Apr 2025 20:42:52 +0200 Subject: [PATCH] Fix #9398 --- .env.example | 7 +++++++ config/mail.php | 39 ++++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.env.example b/.env.example index e53ccacbe9..6ca952fe17 100644 --- a/.env.example +++ b/.env.example @@ -164,6 +164,13 @@ MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_SENDMAIL_COMMAND= +# +# If you use self-signed certificates for your STMP server, you can use the following settings. +# +MAIL_ALLOW_SELF_SIGNED=false +MAIL_VERIFY_PEER=true +MAIL_VERIFY_PEER_NAME=true + # Other mail drivers: # If you use Docker or similar, you can set these variables from a file by appending them with _FILE MAILGUN_DOMAIN= diff --git a/config/mail.php b/config/mail.php index e9742e651a..fa9db71f50 100644 --- a/config/mail.php +++ b/config/mail.php @@ -33,18 +33,23 @@ return [ | and used as needed; however, this mailer will be used by default. | */ - 'default' => envNonEmpty('MAIL_MAILER', 'log'), + 'default' => envNonEmpty('MAIL_MAILER', 'log'), - 'mailers' => [ + 'mailers' => [ 'smtp' => [ - 'transport' => 'smtp', - 'host' => envNonEmpty('MAIL_HOST', 'smtp.mailtrap.io'), - 'port' => (int) env('MAIL_PORT', 2525), - 'encryption' => envNonEmpty('MAIL_ENCRYPTION', 'tls'), - 'username' => envNonEmpty('MAIL_USERNAME', 'user@example.com'), - 'password' => envNonEmpty('MAIL_PASSWORD', 'password'), - 'timeout' => null, - 'verify_peer' => null !== env('MAIL_ENCRYPTION'), + 'transport' => 'smtp', + 'host' => envNonEmpty('MAIL_HOST', 'smtp.mailtrap.io'), + 'port' => (int) env('MAIL_PORT', 2525), + 'encryption' => envNonEmpty('MAIL_ENCRYPTION', 'tls'), + 'username' => envNonEmpty('MAIL_USERNAME', 'user@example.com'), + 'password' => envNonEmpty('MAIL_PASSWORD', 'password'), + 'timeout' => null, + 'scheme' => env('MAIL_SCHEME'), + 'url' => env('MAIL_URL'), + 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)), + 'verify_peer' => env('MAIL_VERIFY_PEER', true), + 'allow_self_signed' => env('MAIL_ALLOW_SELF_SIGNED', false), + 'verify_peer_name' => env('MAIL_VERIFY_PEER_NAME', true), ], 'mailersend' => [ 'transport' => 'mailersend', @@ -53,34 +58,34 @@ return [ 'transport' => 'ses', ], - 'mailgun' => [ + 'mailgun' => [ 'transport' => 'mailgun', ], - 'mandrill' => [ + 'mandrill' => [ 'transport' => 'mandrill', ], - 'postmark' => [ + 'postmark' => [ 'transport' => 'postmark', ], - 'sendmail' => [ + 'sendmail' => [ 'transport' => 'sendmail', 'path' => envNonEmpty('MAIL_SENDMAIL_COMMAND', '/usr/sbin/sendmail -bs'), ], - 'log' => [ + 'log' => [ 'transport' => 'log', 'channel' => env('MAIL_LOG_CHANNEL', 'stack'), 'level' => 'info', ], - 'null' => [ + 'null' => [ 'transport' => 'log', 'channel' => env('MAIL_LOG_CHANNEL', 'stack'), 'level' => 'notice', ], - 'array' => [ + 'array' => [ 'transport' => 'array', ], ],