This is for a tool I have that receives a lot commercial emails and it would only apply to that. It is not for emails that I receive from individuals with yahoo.com, gmail.com, or business accounts.

I'm familiar with retrieving and parsing email headers using imap_headerinfo. I found that imap_header retrieves the entire header as a string and that full header typically includes two IP addresses.

Should I just parse out these IP addresses? Do you know if they accurately represent the IP address of the server sending the email?

Thank you!

Recommended Answers

All 5 Replies

Member Avatar for P0lT10n

You can get their IP but only from your page with

$ip = $_SERVER['REMOTE_ADDR'];

No, that doesn't have anything to do with it.

For example. The store Target sends me an email. I want to get the IP address of the mail server they are using to send me that email.

Member Avatar for P0lT10n

you cant, because you need to code that when the server recibe the mail, read the mail ip... you cant... why do that ???

Its not the host name IP that I am looking for either because the email being sent does not necessarily come come from that server. In fact, with high volume senders, most of the time it doesn't. Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.