Closed herbdool closed 5 years ago
An update: I think X-CiviMail-Bounce
was empty because I was testing with a transactional email. Looks like this bounce processing only works with CiviMail and not sending individual emails. Either way Sparkpost records a bounce.
I've created a PR to address that some properties and variables are undefined some times. For example, when an email is not being sent via CiviMail X-CiviMail-Bounce
will not exist. And if there's no campaign then campaign_id
doesn't exist. I separated the conditions so it's more understandable about when it will stop trying to process the bounce.
@nganivet thanks for merging. Would you be able to create a new release for this and the other changes merged?
The callback post data is definitely a bounce but seems like the code relies on
$event->rcpt_meta->{'X-CiviMail-Bounce'}
existing. In my testing I can receive data of a bounced email but$event->rcpt_meta->{'X-CiviMail-Bounce'}
doesn't exist. So that means it skips the whole section where it records the bounce in CiviCRM.I'm not sure why X-CiviMail-Bounce is empty now but I'll look into it, and also look into how to process bounces without depending on it. I would think it could since we clearly get the bounce information with the rest of the objects.
Here's a scrubbed sample of what's returned: