Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #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
Reply With Quote
  #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 17 Times in 16 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.
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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 17 Times in 16 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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Grouping plain text into paragraphs igraham XSLT 4 July 16th, 2007 02: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 06:33 AM



All times are GMT -4. The time now is 12:51 PM.


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