Closed eeemarv closed 5 years ago
I have this problem to when the apps try to send the email always return:
Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username
This problem happen on Symfony 4 and swiftmailer bundle 3.2
I got the same problem. As a temporary fix, I use the following configuration for swiftmailer.yaml:
swiftmailer:
transport: '%env(MAILER_TRANSPORT)%'
host: '%env(MAILER_HOST)%'
port: '%env(MAILER_PORT)%'
encryption: '%env(MAILER_ENCRYPTION)%'
auth_mode: '%env(MAILER_AUTH_MODE)%'
username: '%env(MAILER_USERNAME)%'
password: '%env(MAILER_PASSWORD)%'
spool: { type: 'memory' }
Less sexy.
@modnarlluf I use the MAILER_URL with url (percent) encoded query parameters for now. This issue is about that this is not possible with USERNAME and PASSWORD in their normal location:
smtp://USERNAME:PASSWORD@email-host.com:587?encryption=tls
This form is also used for configuring Doctrine: https://symfony.com/doc/current/doctrine.html#configuring-the-database
Duplicate of this issue: https://github.com/symfony/swiftmailer-bundle/issues/270
In the "url" configuration option, when username and password are passed in the standard way:
They are not url decoded. So they can't contain any reserved chars like ! * ' ( ) ; : @ & = + $ , / ?# | (RFC 3986)
However, when username and password are passed as query parameters, they are url decoded as part of the parse_str function.
It might also be good to mention in the documentation that when using the url configuration option, the username and password should be url encoded (percent-encoding) when they contain reserved chars. I'm using AWS SES and my password contains a slash (/) and a plus sign (+). It doesn't work when used raw either in the query (the + becomes a space) or in the standard way (the parse_url function returns false because of the slash).