i'm using PHPMailer to send emails to my guests. i've been hand coding the headers etc and it finally got old so PHPMailer does it in a snap!
however now i would like to save a copy of the email i send as an .eml file for archiving.
trying to figure out how to get exactly the file that PHPMailer sends (without sending it and then retrieving it from IMAP which seems wasteful).
tried the callback action function and have it partially working, but saving just the $body doesn't work. needs something else (headers, MIME, etc) trying to add on the beginning but unable to make it work.
has anyone solved this problem? is there a way to pull the whole email string?
Firstly, the project is now on GitHub: https://github.com/PHPMailer/PHPMailer
You can get the complete message by getting it ready to send as usual, but then call $mail->PreSend(), then you can get the message by calling $mail->GetSentMIMEMessage(). This doesn't require that you actually send anything.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.