InnoGE / laravel-msgraph-mail

Laravel Mail driver for Microsoft Office 365 using the MSGraph API
MIT License
26 stars 7 forks source link

Fix MicrosoftGraphTransport to handle sending from alias (#26) #29

Closed naifmhd closed 3 weeks ago

naifmhd commented 4 months ago

To send the email from an alias

After assigning Send As to the user set the following config.

add a new config to use alias as from address

'send_from_alias'=> true

full configuration will be as follows

'microsoft-graph' => [
      'transport' => 'microsoft-graph',
      'client_id' => env('MICROSOFT_GRAPH_CLIENT_ID'),
      'client_secret' => env('MICROSOFT_GRAPH_CLIENT_SECRET'),
      'tenant_id' => env('MICROSOFT_GRAPH_TENANT_ID'),
      'from' => [
          'address' => env('MAIL_FROM_ADDRESS'),
          'name' => env('MAIL_FROM_NAME'),
      ],
      'send_from_alias'=> true,
]

also create a new environment variable to set send from alias address

MAIL_FROM_ALIAS="info@example.com"

geisi commented 4 months ago

@naifmhd, Thanks for your contribution! Could you please clarify the purpose of the alias configuration you've introduced? How does it improve on simply modifying the MAIL_FROM_ADDRESS configuration directly? Looking forward to your insights!

geisi commented 3 weeks ago

This PR is closed due to inactivity. If you still think it is a good addition to this package, please open a new PR. Thanks!