Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6
This is the forum to discuss the Wrox book Professional Ajax, 2nd Edition by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780470109496
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 11th, 2010, 09:15 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
  #2 (permalink)  
Old March 11th, 2010, 04:56 PM
jmcpeak's Avatar
Wrox Author
Points: 467, Level: 7
Points: 467, Level: 7 Points: 467, Level: 7 Points: 467, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts
Default

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.
  #3 (permalink)  
Old March 12th, 2010, 08:34 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #4 (permalink)  
Old March 12th, 2010, 10:17 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
  #5 (permalink)  
Old March 12th, 2010, 03:23 PM
jmcpeak's Avatar
Wrox Author
Points: 467, Level: 7
Points: 467, Level: 7 Points: 467, Level: 7 Points: 467, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts
Default

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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Grouping plain text into paragraphs igraham XSLT 4 July 16th, 2007 01:10 PM
getting plain text for .svc file bhavsac Windows Communication Foundation 8 November 9th, 2006 02:27 PM
Changing between bold and plain text in a text box funkybuddha Access 2 January 3rd, 2006 10:15 AM
text/plain forces download pgtips Classic ASP Basics 1 September 12th, 2003 05:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.