Callback post data is a bounce but getting undefined property: X-CiviMail-Bounce
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:
$sparkpost callback elements = array(1) {
[0]=>
object(stdClass)#319 (1) {
["msys"]=>
object(stdClass)#320 (1) {
["message_event"]=>
object(stdClass)#349 (29) {
["bounce_class"]=>
string(2) "10"
["customer_id"]=>
string(5) "26155"
["error_code"]=>
string(3) "550"
["event_id"]=>
string(18) "6255XXXXXXXXXXX"
["friendly_from"]=>
string(15) "info@xxxxx.ca"
["initial_pixel"]=>
bool(true)
["injection_time"]=>
string(24) "2019-07-08T17:37:26.000Z"
["ip_address"]=>
string(14) "XX.XXX.XXX.XXX"
["ip_pool"]=>
string(6) "shared"
["message_id"]=>
string(20) "0022XXXXXXXXXXXX"
["msg_from"]=>
string(51) "msprvs1=18092XXXXXX=bounces-26155@mail.XXXXX.ca"
["msg_size"]=>
string(4) "1220"
["num_retries"]=>
string(1) "0"
["rcpt_meta"]=>
object(stdClass)#321 (0) {
}
["rcpt_tags"]=>
array(0) {
}
["rcpt_to"]=>
string(16) "123@fakemail.com"
["raw_reason"]=>
string(73) "550 5.1.1 <123@fakemail.com> Recipient not found. <http://x.co/irbounce>"
["reason"]=>
string(62) "550 5.1.1 ...@... Recipient not found. <http://x.co/irbounce>"
["recv_method"]=>
string(4) "rest"
["routing_domain"]=>
string(12) "fakemail.com"
["sending_ip"]=>
string(13) "XX.XX.XXX.XXX"
["subject"]=>
string(13) "test bounce 2"
["template_id"]=>
string(27) "template_625XXXXXXXXXXXXX"
["template_version"]=>
string(1) "0"
["timestamp"]=>
string(10) "1562607447"
["transactional"]=>
string(1) "1"
["transmission_id"]=>
string(18) "625XXXXXXXXXXXXX"
["type"]=>
string(6) "bounce"
["raw_rcpt_to"]=>
string(16) "123@fakemail.com"
}
}
}
}