php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

Save message to file

Open Webklex opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. I would like to save a message / email as file. This file should contain both the raw header and raw body (including all attachments).

Describe the solution you'd like Callable via Message::save($path)

Additional context Inspired by @bilogic question https://github.com/Webklex/laravel-imap/issues/437

Webklex avatar Aug 09 '22 07:08 Webklex

This is some simple code I am using to save the email to a .eml file

$eml = "";
$eml .= json_decode(json_encode($email->getHeader()), true)['raw'];
$eml .= $email->getRawBody();
file_put_contents($folder . "/" . $filename, $eml);

roylanceb avatar Aug 25 '22 08:08 roylanceb