jjaffeux / postmark-inbound-php

Simple API wrapper for Postmark Inbound Hook
http://developer.postmarkapp.com/developer-inbound.html
MIT License
97 stars 20 forks source link

Received SPF (getting full record) #17

Open kriiv opened 2 years ago

kriiv commented 2 years ago

Hi,

In the readme, for some reason Received-SPF is listed twice under Headers.

$inbound->Headers('Received-SPF');
$inbound->Headers('MIME-Version');
$inbound->Headers('Received-SPF'); // pass neutral fail

I am wanting to get the full value of "Received-SPF" to then parse and get the sender IP address. Currently it returns pass, neutral or fail, as described.

Is there an easy way to get the full record?

Many thanks, Martin

kriiv commented 2 years ago

For the moment, I'm looking through $inbound->Headers and grabbing "Received SPF" full record manually. :)

$json = json_decode(file_get_contents('php://input'));

foreach($json->Headers as $header) {
    if($header->Name == 'Received-SPF') {
        return $header->Value;
    }
}