Page 1 of 1

Get body?

Posted: Fri Oct 05, 2007 7:06 pm
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?

Re: Get body?

Posted: Fri Oct 05, 2007 9:34 pm
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();

Posted: Sat Oct 06, 2007 9:53 am
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)

Posted: Sat Oct 06, 2007 11:57 pm
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.