Question

I'm reading emails from pop3 server with zend mail component.

What I want is to know who is sent this email and when I try $message->from I see "FirstName LastName" without senders email.

I do print_r($message->getHeaders()) and do not see sender's email in any header from this email.

I thought that senders email is required and always must be set. Anything wrong here?

Is that possible to have email with "from" header with only First/Last name without email?

Was it helpful?

Solution

As per my comment:

if you print_r() a valid from header and the address is in angle brackets, you may only see it by viewing the HTML source, because the angle brackets and email address may be treated as an (albeit unrecognised) HTML tag, by the browser.

However, if anyone encounters this issue in the future (and the email address does not show in the HTML source), it is worth bearing in mind that the sender could have sent an email without a From: address, even though that is technically invalid.

OTHER TIPS

Yes, this is totally possible. There are 2 usually "FROM" addressess with every email. 99% of the time, these are the same values, but they can be different. There is the MAIL FROM address that is used during the SMTP session, that issues the MAIL FROM command. Then, there is the FROM address found in the email message headers (this FROM address is sent during the SMTP DATA command). This is how you can get email spoofing.

Think of it this way (in the snail mail physical world). You can have a FROM address on the outside of an envelope (this would be equiv to the MAIL FROM command). This is supposed to be the person sending the message. You can then have a FROM value that is different on the letter head that is inside the envelope. This would be the FROM value you are seeing in the email headers.

Here is an example of some raw headers without a FROM address

From: "Steve James"  
To: "John Doe" <you@yourcompany.com>  
Date: Fri, 24 Feb 2012 07:43:40 -0800  
Subject: Here is the progress report  

....  

Hopefully I didn't make that about as clear as mud.

--

Use the following format:

Firstname Lastname <vasya@poupkine.com>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top