-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel 11 with symfony/mailer v7.2.0 - UnsupportedSchemeException for SMTP configuration #53721
Comments
Symfony Mailer 7.2 isn't supported. However, a PR was recently merged. #53585 |
A fix has been merged and pending a release (#53585). You should run |
@crynobone So we downgraded manually, but the issue still exists with version |
v7.1.6 works for me |
Does still not work for me. the config file:
env:
error: |
Try |
ci does that usually, but I'll give it a test, good idea. |
hey, had the same issue here and downgrading to symfony/mailer 7.1.6 fixes it |
got same issue, I solve by downgrading to 7.1.6 |
Downgrading didn't work for me but setting 'scheme' to 'smtp' in config 'mailers.smtp' did.
If you're curious why this solution works, the code responsible for creating smtpTransport from protected function createSmtpTransport(array $config)
{
$factory = new EsmtpTransportFactory;
$scheme = $config['scheme'] ?? null;
if (! $scheme) {
$scheme = ! empty($config['encryption']) && $config['encryption'] === 'tls'
? (($config['port'] == 465) ? 'smtps' : 'smtp')
: ''; // here
}
$transport = $factory->create(new Dsn(
$scheme,
$config['host'],
$config['username'] ?? null,
$config['password'] ?? null,
$config['port'] ?? null,
$config
));
return $this->configureSmtpTransport($transport, $config);
} |
The scheme will default to
Also, check your .env file to ensure the encryption value is set correctly. For example, in my case, I have: env
If you need a different encryption type, you will need to manually specify the scheme value. To do so, check your
|
When installing mailpit with Laravel Sail, .env is set with MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null As others have said, changing it to |
Same error for me and downgrading to v1.7.6 works for me. composer show symfony/mailer Waiting for (A fix has been merged and pending a release (#53585) |
you have to change MAIL_DRIVER to MAIL_MAILER in your .env file |
downgrading worked, but also adding the scheme key without downgrading worked
|
Thanks! @mathiaswillburger it's working. |
I got the same error today, when I did:
I got this... The solution was to change the .env file..... But that was setting up mailhog. |
This fixed my ISSUE. Thanks |
To fix the probleme, in the config file mail.php, add the following to the smtp mailer :
|
this works! but do not add MAIL_SCHEME on the env file, it will show the error again |
I have a project wich was upgraded from laravel 6 to 11, my config/mail.php doesn't have a "mailers.smtp" key, so I notice if we add the key just like: `/*
` fixes the issue, in case someone has to deal with a similar issue. |
Still getting the error for mailpit even when setting encryption to tls and defining smtp mailer |
I have just submitted a PR. There is no need to downgrade. You can simply define |
Laravel Version
11.34.2
PHP Version
8.3.14
Database Driver & Version
No response
Description
After upgrading Laravel 8 -> 9 -> 10 -> 11, I noticed that it threw error when trying to send an email.
I verified that mail config (smtp transport) was correct.
When I upgraded to Laravel 11, Composer installed symfony/mailer with version 7.2.0.
I checked what my other Laravel 11 project had - it was 7.0.7.
So I tried to downgrade from 7.2.0 to 7.0.7, it did not throw error and I was able to send/receive email.
composer.json
Steps To Reproduce
The text was updated successfully, but these errors were encountered: