How to find e-mail address source

Some times we need to find the source location of the sender of an email, or even the IP Address of the sender. This may not be a general case requirement, but even for the fun of it, or just out of curiosity, the recipient would want to search for such information.

One of our twitter followers asked us the same question on twitter

I decided to try this on one of the spam advertisers:

In the following steps you’ll learn how to find and copy an email header and paste it into the Trace Email Analyzer to get the sender’s IP address and track the source.

Would you like to track down (or trace) where an email that you received came from?

This Trace Email tool can help you do precisely that. It works by examining the header that is a part of the emails you receive to find the IP address. If you read the IP Lookup page, you’ll get a clear idea of what information an IP address can reveal.

(A header is the unseen part of every sent and received email. To learn a little bit more on headers, click here. You can see an example of a header at the end of this article.)

What email provider do you use?

To find the IP address of a received email you’re curious about, open the email and look for the header details. How you find that email’s header depends on the email program you use. Do you use Gmail or Yahoo? Hotmail or Outlook?

For example, if you’re a Gmail user, here are the steps you’d take:

  1. Open the message you want to view
  2. Click the down arrow next to the “Reply” link
  3. Select “Show Original” to open a new window with the full headers

STEPS TO TRACING AN EMAIL:

  1. Get instructions for locating a header for your email provider here
  2. Open the email you want to trace and find its header
  3. Copy the header, then paste it into the Trace Email Analyzer below
  4. Press the “Get Source” button
  5. Scroll down below the box for the Trace Email results!

You should know that in some instances people send emails with false or “forged” headers, which are common in spam and unwanted or even malicious e-mail. Our Trace Email tool does not and cannot detect forged e-mail. That’s why that person forged the header to begin with!

Results:


source: http://whatismyipaddress.com/

Local Mail Server With HMailServer

When we write code to push out emails to our customers or visitors, we want to be confident it’s going to arrive at the destination, looking the way we expect.

Most local windows server setups with XAMPP or WAMP won’t by default be setup with a mail server and setting one up can be a pain.

Luckily hMailServer is an option that you may want to try out

hMailServer

This quick step-by-step guide should get you up and running with local mail functionality and a test script in under 20 minutes.

Start by going to www.hmailserver.com, click download in the menu and choose the latest build (hMailServer 5.6.4 – Build 2283).

Browse to the download location and open the exe file.

Follow Next as shown:

 

 

For testing the Mail You can follow the following tutorial

Email Validation

CHALLENGE DESCRIPTION:

You are given several strings that may/may not be valid emails. You should write a regular expression that determines if the email id is a valid email id or not. You may assume all characters are from the english language.

INPUT SAMPLE:

Your program should accept as its first argument a filename. This file will contain several text strings, one per line. Ignore all empty lines. E.g.

foo@bar.com
this is not an email id
admin#codeeval.com
good123@bad.com

OUTPUT SAMPLE:

Print out ‘true’ (all lowercase) if the string is a valid email. Else print out ‘false’ (all lowercase). E.g.

true
false
false
true

Solution:

import java.io.File;
import java.io.FileNotFoundException;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static void main(String... args) throws Exception {
        Main main = new Main();
        main.startFileRead(args[0]);
    }

    public void startFileRead(String filePath) throws FileNotFoundException {
        File file = new File(filePath);


        if (file.exists()) {
            Scanner s = new Scanner(file);
            int n = 0;

            boolean tmp = false;
            while ((s.hasNextLine())) {
                tmp = EmailValidation(s.nextLine());
                System.out.println(tmp);
            }

        }
    }

    public boolean EmailValidation(String line) {
        Pattern pattern;
        Matcher matcher;
        String EMAIL_PATTERN =
            "^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$";
        pattern = Pattern.compile(EMAIL_PATTERN);
        matcher = pattern.matcher(line);
        return matcher.matches();
    }
}