A body is an associative array which can consist of the following keys:
"type", "encoding", "charset", "type.parameters", "subtype", "id",
"description", "disposition.type", "disposition", "contents.data",
"lines", "bytes" and "md5".

User Contributed Notes 14 notes

If you wish to send the output of this function, simply use it for the headers argument of imap_mail() or mail(). Keep in mind that those functions set the To: and Subject: headers, so including them in the envelope will create double entries.

But this is still not a good idea to blanket set every attachment as a application/octet-stream so please consider using the unix command file, or Fileinfo functions (or even trusting file upload mimetype) and pay attention to the code from "derf dot m at reseaunix dot net"

I got a lot of problems with attachments (multipart emails) and the fix directly below this note.instead just include it in the optional headers argument as previously suggested:

<?php$mail = str_replace("\r","",imap_mail_compose($envelope, $body));imap_mail($_POST["to"],$_POST["subject"],'',$mail);?>"Nothing like a fix on a fix".

If you want to copy the message to ie: a sent folder do:<?php//take note of the link: $this->mbox, and the constant: self::$imapStream$envelope["to"] = $_POST["to"]; //included with imap_mail$envelope["subject"] = $_POST["subject"]; //included with imap_mail$mail = imap_mail_compose($envelope, $body); //note no problems with \rimap_append($this->mbox,self::$imapStream."INBOX.Sent",$mail ,"\\Seen");?>See imap_append for more info.... Enjoy!