A simple question (One which I do not have the answer to yet).

One small yet important aspect of my current project is collecting IP addresses via email registration/email confirmation.

I assume seeing an IP is not difficult (User's email header?)

My question is:
Is this IP the IP of the server hosting the email service (For example, GMail) or is it the actual email of the User, that is, coming from their actual connection on their machine? I need the User's home/machine IP, not the email Host's.

Thank you in advance.


I am not sure that I got the way that you collect those IP’s . You said “email registration/email confirmation” probably that means that “confirm” an email registration by sending a special link to each one. If this is the case and you get the IPs through the confirmation tier then of course it is the visitor’s ISP IP.

Thank you, jkon.

Honestly, I have not figured out the details and have not yet started writing the code for this.

The question posted: It just popped into my head while coding something else; I wanted to be sure not to forget this question, so I immediately posted it.

Kind regards,

If you have the user submit a form and on that form, you are collecting the IP address, then yes...it's the public address the user is coming from. I say public because you could have a scenario where is user is sitting somewhere connected to a wifi network and what you may collect is the public IP of that network.

If you need the IP to determine what country they are coming from that is fine. If you are trying to tie and IP to a user that's a bit more difficult. People have different devices that connect to all sorts of networks.

And to add to this. Like @jkon said, it will be the ISP's designated IP for that client.

In most cases everytime your router connects to the ISP it will be designated a new IP address and therefore collecting their current IP address is pretty useless as next time they visit the website their IP address may well have changed. This is called a dynamic IP address.

Also the IP in the header of an email I beleive will be the Email Server's IP address (don't quote me). It's easy to test though.

My advice would be to grab the users IP address on filling out the registration form.

Also the IP in the header of an email I beleive will be the Email Server's IP address (don't quote me). It's easy to test though.

When you examine the headers of an email message, there are usually many, many ips listed since mail will flow through a series of different SMTP servers in each organization (sending and receiving), none of the IPs that belong to the client sending the actual email message.

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.