Announcement

Collapse
No announcement yet.

Testing your Mail Server

Collapse
X
Collapse
  •  

  • Testing your Mail Server

    Telnet to your smtp server using the following:
    "telnet example.com 25". The number "25" is the default portnumber for outging mail, defined by IANA.
    Substitute the address with your own address or ip number.
    Even though this might very well be possible to do on your ISP mail server, dont!!
    This will give you the SMTP server banner. I hope this has been changed or spoofed to protect from banner grabbing.
    In my example, it gives me "220 example.com ESMTP" and tell you a bit about it cababilities.
    Return codes beginning with "2" as in "220" is equivalent with success. All these return codes are stated in the RFCs.
    But you should already know this as I assume you do this on your own server only.

    Note: You might need to do a "HELO <domain>" or "EHLO <domain>" to identify. If not, your mail server should have the configuration checked. When connection was established the server banner contained "ESMTP" as in Extended SMTP. Then we should use the "EHLO" command instead of "HELO" which we would use if the server had replied with SMTP only.
    As we are sending an email to ourself we will use "EHLO example.com" in this example.
    The EHLO command is us identifying who we are.

    Now, let us try to send ourselfs an email.
    Type in the following to set the sender:
    "mail from: [email protected]<CRLF>"
    Remark that the "<CRLF>" is just pressing the Return key.

    Type in the following to set the receipt:
    "rcpt to: [email protected]<CRLF>"
    Repeat above command for every receipt. The message is accepted by the server when at least one receipt has been accepted by the server.
    If your from address differs from the domain the mail server is handeling and the "rcpt to" do not fail, you might be allowing mail relay. This is a bad thing.

    Type "data<CRLF>" to start the message.
    Hi
    This is a test!!

    Type the following combination to end the message and put the message in the output queue:
    "<CRLF>.<CRLF>"
    This is what the SMTP server expect as a delimiter for your message and the server will most likely tell you this when you enter the "data" command.

    Now, check your inbox!

    In the same way you can test your POP3 server.
    Type the following to connect to your POP3 server:
    "telnet example.com 110". The number 110 is the default port number for POP3 as defined by IANA.
    This will most likely ask your for an account username and password.
    Type in "USER <username><CRLF>" and then "PASS <password><CRLF>". This account must exist on your POP3 server.
    Remark that your username and password is sent in clear text over the network on most mail servers.

    Use the "LIST<CRLF>" command to browse messages stored on the server.
    Remark that all the messages have a unique ID number following the message size in bytes.

    Use this to retrieve or delete messages on the server.
    "RETR 10<CRLF>" will retrieve the message with the ID of 10.
    "DELE 10<CRLF>" will mark the message with ID 10 for deletion. The message will actually not be deleted until the the UPDATE state is entered.

    Use the "QUIT<CRLF>" command to exit the session with the mail server. This might put the server in "update state" and delete messages that are marked for deletion.

    Testing your IMAP server is also quite easy.
    "telnet example.com 143" will connect you to the IMAP server. Port 143 is the default for the IMAP protocol.
    Remark that IMAPv3 uses port 220.
    The server will give you a lot of output. Each line will be prefixed with an unique identifier (a known count) called a "tag" so you can relate your request with the reply returned by the server.
    Normally this is a 64 bit identifier but below example will do for now.

    Send "1 capability<CRLF>" to the server to have the server tell you its capabilities.
    After the capability listing the server will reply will be something like "1 OK CAPABILITY completed". Remark the "1" in the reply.

    Login using "2 login username password<CRLF>". This user must exist on the server. Ofcourse you have to replace the username and the password with you own login credentials to successfully authenticate.

    Type in "3 namespace<CRLF>" to see where in the folder hierarchy the user is located.
    At this point I reccomend testing the rest with a proper email client to ease your verifications.
    This is a featurific protocol so Ill just keep this brief. You verified that are able to log in and issue commands.
    Send a "4 logout<CRLF>" to the server to logout and end the connection.

    Visit below for commands and technical details.
    http://www.ietf.org/rfc/rfc2821.txt for SMTP.
    http://www.ietf.org/rfc/rfc1939.txt for POP3
    http://www.networksorcery.com/enp/rfc/rfc3501.txt for IMAP.

    For more information on this topic, google for the most recent version of the RFC covering SMTP, IMAP4 and POP3.

    The mailserver will most likely tell you how and what to type as a response to you if you get it wrong.

    Note. If you do this directly from a DOS prompt from a windows box, you will most likely have problems using backspace on the keyboard.
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    Latest Articles

    Collapse

    • Testing your Mail Server
      by Resheph
      Telnet to your smtp server using the following:
      "telnet example.com 25". The number "25" is the default portnumber for outging mail, defined by IANA.
      Substitute the address with your own address or ip number.
      Even though this might very well be possible to do on your ISP mail server, dont!!
      This will give you the SMTP server banner. I hope this has been changed or spoofed to protect from banner grabbing.
      In my example, it gives me "220 example.com...
      08-06-2016, 10:38 PM
    • Knowing your System Performance and State
      by Resheph
      Here are a few command line tools that will help you estimate your system usage and performance.
      There is a lot more information on this in the man pages so take a look there also. If you dont know your average system load you will not be able to determine if the load is in a peaking state or if the host is able to handle more load.
      Note that some commands might require installation of a few packages.

      Below gives a nice simple performance view of a HDU. Ofcourse running...
      08-06-2016, 10:35 PM
    • Browsing your Hardware in Linux
      by Resheph
      Sometimes it can be quite a challenge to find out what hardware you have but it is actually quite easy.
      Here are a few commands and some sample output for you.

      USB devices are usually easy to identify because you can just pick them up and look at them.
      Below will help you out with the few that just say NoName on it. Often those noname ones are the same as the named ones just with another wrapping. Below display a list of detected USB devices.

      # lsusb
      Bus...
      08-06-2016, 10:34 PM
    • Keeping an Eye on Logfiles
      by Resheph
      If you want to watch a log file and have it update when ever new content is added the "tail" command is an easy on-the-fly tool to use.
      Ofcourse for long term use other implementations of log file analyzers or syslog services would be better.
      Here is a short example and some sample output showing a failed root login attempt.

      # tail -n 20 -f -s 5 /var/log/auth.log
      Feb 17 04:11:09 testbox login[4822]: pam_unix(login:auth): authentication failure; logname=LOGIN...
      08-06-2016, 10:31 PM
    • Learn which Libraries Programs Call
      by Resheph
      Sometimes it comes in handy to know what libraries and what versions of those libraries some software is depending on.
      This is quite easy and is done with the "ldd" command.

      Here are the dependencies that the "ls" command has. Remark that you have to use the absolute path as ldd does not support the use of the search path stated in the environment variable PATH.

      # ldd /bin/ls
      linux-gate.so.1 => (0xb7fd4000)
      librt.so.1 => /lib/i686/cmov/librt.so.1...
      08-06-2016, 10:29 PM
    Working...
    X