jdavidbakr / mail-tracker

Package for Laravel to inject tracking code into outgoing emails.
MIT License
567 stars 129 forks source link

Call to a member function getBody() on null #178

Closed neerajsohal closed 2 years ago

neerajsohal commented 2 years ago

Hi,

I am getting the following exception when I am using SES as Mail Transport.

Call to a member function getBody() on null {"exception":"[object] (Error(code: 0): Call to a member function getBody() on null at /vendor/jdavidbakr/mail-tracker/src/MailTracker.php:84)

Code block where this is happening: https://github.com/jdavidbakr/mail-tracker/blob/7e323deb12d1003823a0153d648ec1b8af94a213/src/MailTracker.php#L83-L86

I tried digging into the code but was not able to properly pinpoint the issue.

What I could identify so far is that this issue is happening only when I use SES. The package is not able to find X-SES-Message-ID in the headers:

https://github.com/jdavidbakr/mail-tracker/blob/7e323deb12d1003823a0153d648ec1b8af94a213/src/MailTracker.php#L84

I also realised that X-SES-Message-ID is not being set anywhere in the library (except in the test suite here and here )

Can you please help? Or maybe I am missing something?

I am using v6.0.3 with Laravel v9.x

jdavidbakr commented 2 years ago

What exact version of Laravel v9? They removed the X-SES-Message-ID header but it was restored I think in 9.6.0

neerajsohal commented 2 years ago

Hi,

I am using v9.5.1

jdavidbakr commented 2 years ago

Try updating to 9.6.0 - they took out an important part of the framework that broke SES, but it was restored it 9.6.0

neerajsohal commented 2 years ago

It's working after updating Laravel.

I think this edge case could be added to README for others to find.