From: Dave M G on
PHP Users,

I have implemented the POP3 class in the Pear libraries to retrieve
emails with PHP:
http://pear.php.net/manual/en/package.networking.net-pop3.getparsedheaders.php

It's basically working fine. I can download mail, get headers, all that
good stuff.

The problem is, when I extract the "From" header, it's not the email of
the sender. It's their just their name.

Unless I'm overlooking the obvious, there isn't a field that simply
states the sender's original sending address.

Surely that information is available...?

How do I get the sender's email address?

Any advice would be much appreciated.

-- Dave M G

From: richardh on
Hi,

> The problem is, when I extract the "From" header, it's not the email of
> the sender. It's their just their name.

It is probably the fact that it looks like this:

Richard Heyes <richard(a)foo.com>

Because the address is in angle brackets, it's being interpreted as a
HTML tag by your web browser. Try viewing the sauce and it may be
there. If so, you will need to pass the string through
htmlspecialchars() before displaying it.

If on the other hand you want the envelope sender (ie the SMTP sender
address), then you're out of luck as the envelope is lost when the
email is stored in POP3.

--
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 31st October)
Lots of PHP and Javascript code - http://www.phpguru.org