Problem/Motivation
When trying to send a test mail : The website encountered an unexpected error. Try again later.
TypeError: Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport::setPassword(): Argument #1 ($password) must be of type string, null given, called in /data/web/xxxxxxxxxxxx/current/web/modules/contrib/symfony_mailer_office365/src/Office365EsmtpTransportFactory.php on line 57 in Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport->setPassword() (line 93 of /data/web/xxxxxxxxxxxx/current/vendor/symfony/mailer/Transport/Smtp/EsmtpTransport.php).
Steps to reproduce
Drupal 11.3.13
Install module
Set credentials in back office OR in settings.php
OAuth connect OK
Set transport type in policy
Try to send a test mail
Impossible to get Client secret in Office365EsmtpTransportFactory
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | symfony_mailer_office365_error.png | 140.89 KB | attraktive |
Issue fork symfony_mailer_office365-3606441
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
attraktive commentedComment #5
yusuf_khan commentedHi @attraktive,
I opened an MR with a fix:
https://git.drupalcode.org/project/symfony_mailer_office365/-/merge_requ...
The issue appears to happen when the saved Symfony Mailer transport configuration does not contain the Office365 client secret, even though the module configuration does. In that case the DSN password becomes NULL and Symfony’s EsmtpTransport::setPassword() throws a TypeError.
The MR updates the transport plugin to fall back to the current Office365 module configuration when the saved transport configuration is missing values, and also guards the transport factory so setPassword() never receives NULL.
I ran PHP syntax checks and PHPCS on the touched files.
Comment #6
yusuf_khan commentedComment #7
attraktive commentedthanks ;) when will it be merged please ?
Comment #8
n1k commented@attraktive If you could test this in your setup and verify that it fixes the issue, please set the issue status to "Reviewed & tested by the community", I will merge it then.
I'm also preparing a stable release, that I can hopefully get done in the next weeks.
Comment #9
attraktive commentedI've tested it yesterday, and it is doing the job thanks ;)
Comment #10
attraktive commentedComment #12
n1k commentedCool! Thanks everyone. Merged and I will create a new alpha release due to the severity on this one.
Comment #14
n1k commented