Can you explain how to find ip address of email sender in gmail?

611    Asked by Ankesh Kumar in SQL Server , Asked on Dec 22, 2021

Is there any way of querying the relay server to get the IP address of the sender by specifying the unique Message-ID of that email? How can I do it? 

Answered by Anisha Dalal

To answer how to find ip address of email sender in gmail, it can potentially be done through some sort of social engineering, if you can send an email back to the original sender and get them to click on a link in the email. You need to set up a website which logs the visitor's IP address, then somehow make the person who sent you that email visit your site. This probably involves sending them an email and hoping they read the email and click a link in it.

A related approach is to send them a HTML email that contains an inline image hosted on your website. However, most email clients do not load linked images by default, precisely to protect the privacy of their users. Therefore, in most cases this will not work (unless the person just happens to have overridden the defaults in their email client).

Therefore, a more realistic approach is to send them an email containing a link, and hope they will click on the link.

Example PHP code to log the visitor's IP address (from http://www.binrev.com/forums/index.php/topic/20288-php-ip-logger/):

header('Content-type: image/jpeg');

readfile('image.jpg');

$filename = "logged.txt";

   $somecontent = "Connection from:".$_SERVER['REMOTE_ADDR']." at ".date("r",time())."
";

   if ($handle = fopen($filename, 'a')) {

           fwrite($handle, $somecontent)

           fclose($handle);

   }

?>



Your Answer

Interviews

Parent Categories