-
-
Notifications
You must be signed in to change notification settings - Fork 234
Description
Winter CMS Build
1.2
PHP Version
8.0
Database engine
MySQL/MariaDB
Plugins installed
Winter.Pages, Winter.Blog, Winter.User
Issue description
Since upgrading to Winter 1.2 from the previous version, emailing via SMTP has not worked.
The error message when emailing has always been:
Expected response code "250/251/252" but got code "550", with message "550 5.7.1 Relaying denied".
I've looked into why and I have found that the email settings entered in the Winter backend, saved to the database, are not being used when actually emailing within Winter.
This can be tested by pressing the "Send test message" button in the "Mail configuration" backend section.
Upon looking at the code, when "createSmtpTransport($config)" in MailManager.php from laravel is called, the values it is looking for are $config['host'], $config['username'], $config['password'], $config['port'].
However, when "applyConfigValues()" in MailSetting.php is called, both the values from config/mail.php and the database are combined.
The config values that get passed to laravel are in this format:
Array ( [driver] => smtp [host] => smtp.mailgun.org [port] => 587 [from] => Array ( [address] => mailaddress [name] => Winter CMS ) [encryption] => tls [username] => [password] => [sendmail] => /usr/sbin/sendmail -bs [default] => smtp [mailers] => Array ( [smtp] => Array ( [host] => smtp.office365.com [port] => 587 [username] => mailaddress [password] => password [encryption] => tls ) ) )
It seems that laravel then only uses the config values from config/mail.php instead of the database to make the Smtp connection.
Steps to replicate
Leave the config/mail.php as default from the Winter installation.
Add Smtp settings into the Mail configuration section in the Winter CMS and click on "Send Test email".
Error message "Expected response code "250/251/252" but got code "550", with message "550 5.7.1 Relaying denied"." is then presented.
Workaround
As a temporary workaround, put your Smtp configuration values into config/mail.php.