June 12th, 2002, 10:55 PM
How to extract sender's IP address from e-mail header programmatically/manually?
I was wondering how to, within an e-mail header, extract the sender's IP address? I need to do this programmatically, but if someone could inform be of how to do it manually, I could probably be able to figure out the coding aspect of it myself...hopefully. Thanks.
June 13th, 2002, 08:31 AM
hmm, well, is it even possible to get the IP address from the sender of an e-mail by looking at the e-mail header? Thought that everyone just read this post and thought I was going a bit cuckoo with my question...
June 13th, 2002, 10:06 AM
I am not sure it is. The way to tell, if you have access to a Unix box or somesuch, is to send yourself an email. Email messages on a lot of Unix/Linux boxes use the standard sendmail mail handler, that saves emails as text files. You can then view the whole email, including all the headers.
The problem with a lot of email programs today is that they are written for lusers - people who couldn't care less about anything to do with computers. I generally have to tweak my web email accounts so that they always display headers, and even although Outlook offers an option to display email headers, I don't trust it at all.
June 13th, 2002, 10:14 AM
Thanks for the tip jontom! I once read an article somewhere that stated that it was possible to do so. However, when I tried sending myself e-mails to my outlook(earthlink) and yahoo accounts, I could not locate my IP address on those headers. Is there a standard e-mail header style, because the ones that I saw on outlook and yahoo looked different from the ones in the article that I read.
June 13th, 2002, 10:27 AM
Most mail clients have some option where you can toggle between seeing the full mail headers, or not.
For example, for Yahoo mail, there is a link just above the message (along the right margin) that reads either "Full Headers" or "Brief Headers".
In Outlook Express, you can right click on any message entry in a mailbox and select "Properties" then "Details" etc.
June 13th, 2002, 10:51 AM
There isn't really a standard set of headers. What each mail client or server puts in the header is implementation dependant. The only standard headers I can think of are the "From <email addr>" and "Subject: <subject text>", and the reply-to headers, although the "From: <fancy from address>" is becoming quite common too.
Generally the protocol is to ignore anything you don't understand.
Here's a weird thing. I have a Linux email account, a Yahoo email account, and a corporate Outlook account. If I send a zipfile attachment from Outlook, it is attached by UUEncoding,a nd placing it in the body of the message. Both Yahoo and Linux accounts interpret it correctly. If I send a zipfile attachment from my Linux account by piping the UUEncode output to mail, then Outlook reads it correctly, but Yahoo does not. Quite odd. I haven't looked at the headers enough to sort it out - too lazy.
June 13th, 2002, 11:13 AM
hmm, the article I read stated that the IP would be located in the "Receive:" section of the header. However, I often see more than one IP there (and also elsewhere in the header), though I don't think some are the IP's of the sender. I traced some of them, and one led to my school's firstclass client, some to an AT&T area, and some I couldn't track at all.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.