zbateson / mail-mime-parser

An email parser written in PHP
https://mail-mime-parser.org/
BSD 2-Clause "Simplified" License
458 stars 58 forks source link

Get the entire header in a single call #101

Closed lorenzo80 closed 4 years ago

lorenzo80 commented 4 years ago

Hi,

I've the same issue as issue #96!.

The problem is: I've to store the entire header for certain types of received emails. The library allows me to easily get every single child, provided that I know it through getHeader('abc'). Is there a way to get the entire header with a single call?

IE: that's a generic delivery failure header, and I'd like to get it without loops. Return-Path: <> Delivered-To: test_mail@example.com Received: from node.example.net by node.example.net with LMTP id sGhQFAHcBF5HgQAAzoayDw (envelope-from <>) for test_mail@example.com; Thu, 26 Dec 2019 10:12:49 -0600 Return-path: <> Envelope-to: test_mail@example.com Delivery-date: Thu, 26 Dec 2019 10:12:49 -0600 Received: from mailnull by node.example.net with local (Exim 4.92) id 1ikVkn-0003oo-96 for test_mail@example.com; Thu, 26 Dec 2019 10:12:49 -0600 X-Failed-Recipients: recipient@example.com Auto-Submitted: auto-replied From: Mail Delivery System Mailer-Daemon@node.example.net To: test_mail@example.com Content-Type: multipart/report; report-type=delivery-status; boundary=1577376769-eximdsn-1777210027 MIME-Version: 1.0 Subject: Mail delivery failed: returning message to sender Message-Id: E1ikVkn-0003oo-96@node.example.net Date: Thu, 26 Dec 2019 10:12:49 -0600

Thanks again!

lorenzo80 commented 4 years ago

Awesome, I somehow managed to miss getRawHeaders() for an hour and then I found it one minute after opening the issue. Time to rest.