Open paindaveine opened 4 months ago
@paindaveine I tried to fix that issue in the https://github.com/InnoGE/laravel-msgraph-mail/tree/30-bug-name-not-handled-in-reply-to-and-recipients branch.
Unfortunately in my tests, adding the name property does not change the behaviour. It seems that it is not supported by Microsoft to set the Name implicitly. Can you confirm that?
According to my tests, behavior is different if e-mail address is known by the Microsoft tenant or not. See this example:
$recipientsByAddress[$address][] = [
'email' => 'jeanpdv@gmail.com',
'name' => 'test InnoGE JPA',
];
$recipientsByAddress[$address][] = [
'email' => 'inscription@acadeghezee.be',
'name' => 'test InnoGE Inscription',
];
$recipientsByAddress[$address][] = [
'email' => 'celine@paindaveine.eu',
'name' => 'test InnoGE CPA',
];
First two are email addresses that are known by the sender tenant, either as redirect address ordirectly as a user :
Without the fix, here is the content of to: section in the raw message:
To: Jean Paindaveine -adresse gmail <jeanpdv@gmail.com>,
=?iso-8859-1?Q?Inscription_acad=E9mie_eghez=E9e?=
<inscription@acadeghezee.be>, "celine@paindaveine.eu" <celine@paindaveine.eu>
You can see names are the ones of microsoft tenant if known, and copy of email address if not.
With the fix, here is the content of to: section in the raw message:
To: Jean Paindaveine -adresse gmail <jeanpdv@gmail.com>,
=?iso-8859-1?Q?Inscription_acad=E9mie_eghez=E9e?=
<inscription@acadeghezee.be>, test InnoGE CPA <celine@paindaveine.eu>
You can see names are still of microsoft tenant if known, but this time the name explicitly added in recipients is used instead of email address if not known by the tenant.
According to my tests, the fix corrects the usage of names for "external" addresses not known by the microsoft tenant of sender, but it changes indeed nothing for known addresses, as stated in original post.
Anyway, many thanks for your code and explanation! I was stuck by frequent and unavoidable session timeout in using Horizon with SMTP server...
What happened?
When couples (email, name) are provided in message, only email addresses are kept in the final message sent, except for e-mail addresses known by the tenant, for which the name known in tenant is used.
Seems that problem can be solved by adding one line
'name' => $address->getName(),
in function transformEmailAddress() of MicrosoftGraphTransport.phpHow to reproduce the bug
Send e-mail with recipient or "reply to" not known by the tenant
Package Version
1.3.0
PHP Version
8.2.11
Laravel Version
11.6.0
Which operating systems does with happen with?
macOS, Linux
Notes
No response