Skip to content
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

[Bug]: From settings of email or notification are ignored #13

Closed
sanderbaas opened this issue Nov 27, 2023 · 4 comments · Fixed by #14
Closed

[Bug]: From settings of email or notification are ignored #13

sanderbaas opened this issue Nov 27, 2023 · 4 comments · Fixed by #14
Labels
bug Something isn't working

Comments

@sanderbaas
Copy link

What happened?

I have set the email from address in my .env file to [email protected] . When I send an email where I have specified another from address with ->from('[email protected]') the email is still sent from the email address that was specified in the config.

How to reproduce the bug

Set the EMAIL_FROM_ADDRESS in .env to one address and send an email with ->from('[email protected]').

Package Version

1.0.5

PHP Version

8.2

Laravel Version

10

Which operating systems does with happen with?

Linux

Notes

Perhaps https://github.com/InnoGE/laravel-msgraph-mail/blob/main/src/MicrosoftGraphTransport.php#L58 should be changed (untested):

old
$this->microsoftGraphApiService->sendMail($this->from, $payload);

new
$this->microsoftGraphApiService->sendMail($this->transformEmailAddresses(collect($email->getFrom())), $payload);

@sanderbaas sanderbaas added the bug Something isn't working label Nov 27, 2023
@geisi
Copy link
Contributor

geisi commented Nov 27, 2023

Hi @sanderbaas,

Thank you for bringing this issue to our attention. I've attempted to replicate the problem using our test suite, but so far, I haven't been able to reproduce it. You can review the added test I conducted here: MicrosoftGraphTransportTest.php. It is within the "the configured mail sender can be overwritten" test.

Based on these tests, the MSGraph Mailer appears to be functioning correctly. However, I'm keen to understand more about your experience. Could you provide some additional details or specific steps that might help us reproduce the issue on our end?

Looking forward to your response.

@sanderbaas
Copy link
Author

Hi @geisi ,

Thank you for your rapid response. I have done some tests myself and indeed the payload that is sent to Microsoft Graph contains the correct sender info. However, the endpoint that is used also contains the from email address.

It is being supplied here: https://github.com/InnoGE/laravel-msgraph-mail/blob/main/src/LaravelMsGraphMailServiceProvider.php#L45 and eventually used here to create the actual API request: https://github.com/InnoGE/laravel-msgraph-mail/blob/main/src/MicrosoftGraphTransport.php#L58

When I manually change $this->from into other email address, the email I receive indeed has the correct sender. But maybe I do not understand Microsoft Graph and it has to do with some settings...

@geisi geisi linked a pull request Nov 28, 2023 that will close this issue
@geisi
Copy link
Contributor

geisi commented Nov 28, 2023

Thank you @sanderbaas

I have fixed this issue just update your dependencies, and it should work as expected.

Thank you!
https://github.com/InnoGE/laravel-msgraph-mail/releases/tag/1.1.0

@geisi geisi closed this as completed Nov 28, 2023
@sanderbaas
Copy link
Author

Thanks @geisi it is working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants