Hi,
As we have been struggling with this for some time I wanted to share how we got imap_append working properly with all MIME parts including attachments. If you are sending email and also wish to append the sent message to the Sent Items folder, I cannot think of an easier way to do this, as follows:
1) Use SwiftMailer to send the message via PHP.
$message = Swift_Message::newInstance("Subject goes here");
(then add from, to, body, attachments etc)
$result = $mailer->send($message);
2) When you construct the message in step 1) above save it to a variable as follows:
$msg = $message->toString(); (this creates the full MIME message required for imap_append()!! After this you can call imap_append like this:
imap_append($imap_conn,$mail_box,$msg."\r\n","\\Seen");
I hope this helps the readers, and prevents saves people from doing what we started doing - hand crafting the MIME messages :-0