PHP Classes

Store message with imap_append

Recommend this page to a friend!

      MIME E-mail message sending  >  MIME E-mail message sending package blog  >  How Can PHP Send Emai...  >  All threads  >  Store message with imap_append  >  (Un) Subscribe thread alerts  
Subject:Store message with imap_append
Summary:Works, but only as raw content
Messages:3
Author:Jamin
Date:2012-04-06 16:49:44
Update:2012-04-06 21:48:04
 

  1. Store message with imap_append   Reply   Report abuse  
Picture of Jamin Jamin - 2012-04-06 16:49:44
I am trying to use the output from this class to store the message to my IMAP server's Sent folder.

After sending the message, I do...

$mail->GetMessage($message);
imap_append($imap, "Sent", $message);

...where "Sent" is the full mailbox reference to my Sent folder.

This works for the most part. The mail does store successfully. However, if I go back and look at that message in a mail client, the entire thing seems to be stored as one big plaintext message. I see the entirety of the raw message body (boundary separators, part headers, attachments in base64, etc) as simple text, rather than a clean message. The main message headers are segregated correctly, but everything after that displays as raw content. Other sent messages in that folder (eg. ones that were sent with another mail client) show correctly formatted into individual parts, as expected.

Is there something I'm not doing correctly? Do I need to do something else to the $message output before saving it to the mailbox?

Thanks in advance.

  2. Re: Store message with imap_append   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2012-04-06 20:07:33 - In reply to message 1 from Jamin
Could it be because the default line break is "\n" ?

Try setting the line_break variable to "\r\n" .

  3. Re: Store message with imap_append   Reply   Report abuse  
Picture of Jamin Jamin - 2012-04-06 21:48:04 - In reply to message 2 from Manuel Lemos
That did it. Thank you.