POP3 Email Retreival Problem

Hello,

I have encountered a problem when displaying Email retreived from POP3 enabled email accounts.

I am building a PHP program that will log into a specified gmail account on the click of a button, retreive all the emails in the inbox, and display the important details on sceen i.e. date, from address, to address, subject, body etc.

I have accomplished all the above with no difficulties but have encountered a small but very annoying problem that I cannot seem to find a solution to. Some of the characters within the email are being displayed in a strange format which I believe is hexidecimal. Characters I’ve identified that cause problems include the following:

The £ sign appears as =A3
The equals sign appears as =3D
some spaces/newlines appear as =20
There are also a few others

To retreive the emails by POP3 I have used both the built in IMAP functions and also functions in the PEAR POP3 class. Both are causing the same errors.

If anyone knows why this is happening I’d be very pleased to hear from you as this has been holding me up for days!

Best regards,

Daniel

After much searching on Google I’m pleased to say I’ve now been able to resolve most of the problems I was experiencing. If anyone else has a similar problem this should hopefully help you.

It appears that the content retrieved from an email is stored in what’s known as a “quoted-printable” format. In order to display this as normal html or as a sms message, it needs to be converted to a simpler format. I accomplished this by using the imap_qprint() function which converts the string to an 8-bit format.

With the exception of a few minor problems with some usual, seldomly used characters, this appears to work well. The only real problem I’m having now is occasional equals characters appearing in the middle of text which seems to occur where there were hyperlinks in the email. I’ve already stripped all html tags so I don’t know why this is occuring.