Get body?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
Kaitlyn2004
Forum Newbie
Posts: 15
Joined: Wed May 30, 2007 7:46 am

Get body?

Post by Kaitlyn2004 »

How can I get the content of the message that will be sent? I do not want to actually SEND it, but I want to get all the headers, the message parts, etc... (to run through a spam filter).

How do I GET the email without actually SENDING it?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Get body?

Post by Chris Corbyn »

Kaitlyn2004 wrote:How can I get the content of the message that will be sent? I do not want to actually SEND it, but I want to get all the headers, the message parts, etc... (to run through a spam filter).

How do I GET the email without actually SENDING it?

Code: Select all

$stream =& $message->build();
echo $stream->readFull();
Kaitlyn2004
Forum Newbie
Posts: 15
Joined: Wed May 30, 2007 7:46 am

Post by Kaitlyn2004 »

Oh right! duh! hha

And that builds the entire message, including multipart and attachments, embedded images, etc? (assuming each part is actually set)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Kaitlyn2004 wrote:Oh right! duh! hha

And that builds the entire message, including multipart and attachments, embedded images, etc? (assuming each part is actually set)
It does ;) The only thing that will be missing is the From, To, Repy-To etc headers because Swift adds those during sending and then removes them again. If you need to see those headers you need to set them manually with $message->setFrom(), $message->setTo() etc etc.
Post Reply