I want to filter the Gmail messages I receive in different folders based on the geographic region of the sender.

Is this possible? And if yes, how can it be done automatically?


1 Answer 1


The email headers contain IP addresses that in certain cases could be used to know the geographic location of the user device and the servers used but this could not work for all cases like users using a web email client.

In other words, it's possible but can't be reliably done for all senders. To do this you will require to use Google Apps Script or a third-party application in order to be able to read the messages headers.

  • Ruben is correct, you're going two need two things. 1) IMAP or POP connectivity to the account to pull down the headers of the email and parse out the Received Fields (Their will be multiple) and an IP Database to perform the lookup of the IP's against.
    – Henry
    May 20, 2016 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy