luisdalmolin / laravel-mandrill-driver

Mandrill mail driver for Laravel for version 6+
MIT License
79 stars 38 forks source link

Make Mandrill MessageId available to Laravel + sub accounts/headers bugfix #39

Closed thybag closed 1 year ago

thybag commented 1 year ago

Hi @luisdalmolin, hope this PR all looks okay. Please let me know if there is anything you would like tweaking.

Key changes involved 1) Makes the Mandrill Message ID available to Laravel 2) Adds some basic unit tests for new functionality 3) Fixes a bug where headers were not being passed as part of the message payload.

Mandrill Message Id is now available via the event at

The X-Message-ID convention is taken from Laravel maintained mail drivers including the base SES driver.

The Unit tests work via injecting a mocked Guzzle instance into MailChimp. Tests then just double check the event gets back what it expects from the mandrill API and that all headers are submitted as expected.

While checking headers i also noticed these did not appear to be being correctly passed to the Mandrill API (most notably X-MC-Subaccount). I had to rework the logic a little to ensure these are set on the Message before the logic living in the abstract classes send method, as after this point the headers are updated on a copy of the data, not the actual data that will be sent via the API calls.

With luck this should resolve https://github.com/luisdalmolin/laravel-mandrill-driver/issues/30 and https://github.com/luisdalmolin/laravel-mandrill-driver/issues/31

luisdalmolin commented 1 year ago

I'll tag this as a beta release for now, and once we get a few confirmations it's stable, I can tag a stable release.

luisdalmolin commented 1 year ago

Thank you!

luisdalmolin commented 1 year ago

https://github.com/luisdalmolin/laravel-mandrill-driver/releases/tag/5.0.1-beta

thybag commented 1 year ago

Cheers. I hope its been working well for people so far. I may do a follow up PR when i get a chance just to update the readme with how to get the mandrill message ID + if your interested a config for running tests via GH CI?

luisdalmolin commented 1 year ago

That would be awesome, actually!