forwarding multipart messages
Posted: Thu Mar 06, 2008 4:56 pm
Is there an easy way to forward multipart messages out of an IMAP mailbox using Swift? Right now I'm constructing a new Message using the raw body as retrieved by imap_body(). I'm also attempting to retrieve the Content-Type header from the message in the IMAP box and set the Content-Type header on the Swift Message to the same string using Message->headers->set(), but my string is getting encoded and having a different charset tacked on the end of it, as well as format=flowed. So, it looks like this:
Content-Type: =?iso-8859-1?B?b250ZW50LVR5cGU6IG11bHRpcGFydC9taXhlZDsg?=
=?iso-8859-1?B?Ym91bmRhcnk9QXBwbGUtTWFpbC0yNS05NDY3NTM2MzcN?=;
charset=iso-8859-1; format=flowed
Am I going to have to parse the original Content-Type and set it and its attributes piecemeal with Message->headers->set() followed by Message->headers->setAttribute()? Will this even work for what I'm trying to do (forward a message with the content essentially unchanged except for From, Sender and Return-Path headers)?
I'd really love to not have to parse the entire MIME structure and rebuild a Message from scratch in order to resend it, considering I have the already-packaged MIME message already for free.
Content-Type: =?iso-8859-1?B?b250ZW50LVR5cGU6IG11bHRpcGFydC9taXhlZDsg?=
=?iso-8859-1?B?Ym91bmRhcnk9QXBwbGUtTWFpbC0yNS05NDY3NTM2MzcN?=;
charset=iso-8859-1; format=flowed
Am I going to have to parse the original Content-Type and set it and its attributes piecemeal with Message->headers->set() followed by Message->headers->setAttribute()? Will this even work for what I'm trying to do (forward a message with the content essentially unchanged except for From, Sender and Return-Path headers)?
I'd really love to not have to parse the entire MIME structure and rebuild a Message from scratch in order to resend it, considering I have the already-packaged MIME message already for free.