How can I "build" the message so that I could, for example, write it to a file rather than actually SEND it?
Including headers and everything, of course...
Build message?
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Build message?
Easy way:Kaitlyn2004 wrote:How can I "build" the message so that I could, for example, write it to a file rather than actually SEND it?
Including headers and everything, of course...
Code: Select all
$stream =& $message->build();
file_put_contents($file, $stream->readFull());Code: Select all
$fp = fopen($file, "wb");
$stream =& $message->build();
while (false !== $bytes = $stream->read(8192)) {
fwrite($fp, $bytes);
}
fclose($fp);