Testing SMTP AUTH through Telnet

There are plenty of instructions out there on how to connect to a SMTP server through telnet to test a mail server. What is not as widely documented is how to test to make sure that SMTP authentication is working. All of the SMTP commands are the same except for a couple exceptions. First, instead of issuing “helo hostname”, you need to type “ehlo hostname”. After that you need to login. Testing smtp authentication is not done in plain text like POP3 or IMAP. You need to encode your username and password together. To do this you can run a simple perl statement from the command line. It’s important to remember at this point that the command is in perl, so if there are any funky characters in the password you will need to escape them with a backslash. The username and password also need to be preceded with 00.

perl -MMIME::Base64 -e ‘print encode_base64(“00user@domain.com00pa$$word”)’

Output:

AHVzZXJAZG9tYWluLmNvbQBwYSQkd29yZA==

Then you simply type “AUTH PLAIN” and then paste the encoded output from the previous statement (all on one line):

AUTH PLAIN AHVzZXJAZG9tYWluLmNvbQBwYSQkd29yZA==

235 Authentication successful

If you get this, then either you did the encoding wrong or your mail server is setup wrong . . .

535 Error: authentication failed

Good Luck!





Please VOTE for this page at: ADD TO DEL.ICIO.US | ADD TO DIGG | ADD TO FURL | ADD TO NEWSVINE | ADD TO NETSCAPE | ADD TO REDDIT | ADD TO STUMBLEUPON | ADD TO TECHNORATI FAVORITES | ADD TO SQUIDOO | ADD TO WINDOWS LIVE | ADD TO YAHOO MYWEB | ADD TO ASK | ADD TO GOOGLE


1 Comment


  1. To test pop3/tls (secure pop3):

    openssl s_client -connect mail.hostname.com:995

    Then the usual pop3 commands:

    user user@domainname.com
    pass password
    list
    quit

    Posted December 2, 2007, 6:28 pm

Leave a reply