1

i want to extract the x-message-delivery and ip from outlook ,and i tried the normal library of IMAP ,but there's no specefic tag to search for it. i'm using php in laravel, and i want to fetch those informations and i already connect my imap to HOTMAIL .

 $regExp = '/^(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})\z/i';
            $header = explode("\n", imap_fetchheader($conn, 1));
            echo implode("\n",$header);
          preg_match_all($regExp,implode("\n",$header),$array );
         print_r($array);

this what i tried for ip bur it print empty array and this id the result

Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) [3] => Array ( ) )
  • What have you tried? If you're trying to extract this information, you just download the headers for the message, parse them, and inspect them. The last hop IP before your server is in the top-most Received header. Any Received header after that can't be trusted. – Max May 11 '22 at 13:00
  • yes that what i tried but no seem to work – Ahmed Erraboun May 11 '22 at 14:57
  • And do you see them all in your $header variable? Do you see anything that looks like an IP? Did you write that regexp? – Max May 11 '22 at 15:28
  • no i just copy it yes i see all the information in my $header variable i think the problem is with that regexp – Ahmed Erraboun May 11 '22 at 15:55

0 Answers0