p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 (http://p2p.wrox.com/forumdisplay.php?f=310)
-   -   Multiple text/plain in pop3lib (http://p2p.wrox.com/showthread.php?t=78525)

gillouz March 11th, 2010 09:15 AM

Multiple text/plain in pop3lib
 
I bought your book some years ago and I must say that this was a good thing to do , because I found solutions for a lot of questions I had.

Since I had your book in hand I was able to add a small webmail to my company web portal.

Unfortunatelly, I use pop3lib to get mail with php and I found a "bug" that cause us to miss a part of the texts send by email.

when you recive an email like the one following:

Code:

--Apple-Mail-4-94362960
Content-Type: text/plain;
        charset=utf-8;
        format=flowed;
        delsp=yes
Content-Transfer-Encoding: quoted-printable

hello word!

--Apple-Mail-4-94362960
Content-Disposition: inline;
        filename=BerdozOptic.jpg
Content-Type: image/jpeg;
        name=BerdozOptic.jpg
Content-Transfer-Encoding: base64

/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQA
AAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABQKADAAQAAAABAAACAQAAAAD/2wBD
AAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB

--Apple-Mail-4-94362960
Content-Type: text/plain;
        charset=utf-8;
        format=flowed;
        delsp=yes
Content-Transfer-Encoding: quoted-printable

bye bye

only the last "Content-Type: text/plain;" is found by pop3lib so all the text witch is before the attachement is lost!!

Is there any way to fix this? do you know if a new version of pop3lib is avalable?

Thank you for your help

jmcpeak March 11th, 2010 04:56 PM

POP3Lib probably doesn't properly support inline attachments (it's been too long for me to remember what I did). There isn't a new version available that I'm aware of. It is possible to fix. I'll see if I can get to that this weekend.

gillouz March 12th, 2010 08:34 AM

Dear Jeremy

This would be great. We just launched an iphone app and we are supposed to recive email form this app.

Unfortunatelly the email in iphone OS are sent with inline attachments! so we only get half of the text.

If you can fix this, I think this would be usefull for everyone, as iphone is very popular.

Thank you

gillouz March 12th, 2010 10:17 AM

possible fix
 
Dear Jeremy

I found a way to fx it by changing:

Code:

case "text/plain":
                                        $message = nl2br(htmlentities(implode("\n",$message), ENT_QUOTES, "iso-8859-1"));
                                        $this->hasPlainText = true;
          if (trim($message))
                                                $this->plainText = $message;

to

Code:

case "text/plain":
                                        $message = nl2br(htmlentities(implode("\n",$message), ENT_QUOTES, "iso-8859-1"));
                                        $this->hasPlainText = true;
          if (trim($message))
                                                $this->plainText .= $message;

It work but I don't know if it is a good long time fix

jmcpeak March 12th, 2010 03:23 PM

That should do it. It won't display the image inline, which may be something I address at a later time, but that'll grab all the plain text portions within the message and display them. It looks like the same needs to be done for HTML.


All times are GMT -4. The time now is 11:52 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.