Tuesday, January 25, 2011

how to get Incoming and Outgoing hostnames and ports on a linux email server

I would like to export my emails from my email account on a linux email server to Gmail. So I was wondering how to get its incoming and outgoing hostnames and ports and get to know if it supports POP3 or IMAP? For example, by some commands that I can run on the server's bash shell?

Thanks and regards!

  • I am not 100% sure what you are asking, but to see what is listening, you can use either netstat, or nmap.

    netstat would be local:

    netstat -pan | grep LISTEN | less
    

    nmap can be local or remote:

    nmap remote.host.com
    
    Tim : Thanks. I would like to know hostname and port of the email server, so that I can export my emails from the email server to my Gmail account. The methods you mentioned seem not provide such information.
  • What information do you have about the mail server? Are you able to log into it? This should provide you with the hostname, or you can use the hostname command to get it when you are logged in. If that name doesn't correspond to the "real" hostname, then you can always look it up if you know the IP address of the server, by doing a domain name lookup on it (here is an example looking up 8.8.8.8):

    $ nslookup 8.8.8.8
    Name:    google-public-dns-a.google.com
    Address:  8.8.8.8
    

    The netstat command provided above will tell you what ports the linux server is listening on, but the -n tells it not to resolve IPs and Port names, and instead to display the raw numbers. If you leave off the -n you'll see hostnames and port numbers, or you can just look for the ports that POP and IMAP use, 110 and 143 respectively. Of course it should be noted that those ports are not secure by default, and anything transmitted to them over the internet will be in the clear unless the email client is configured to do a TLS upgrade.

    Hope some of that helps.

0 comments:

Post a Comment