How do I test SMTP Auth using telnet?


To test AUTH LOGIN

Prepare the username and password by encoding them as follows:

 

$ perl -MMIME::Base64 -e 'print encode_base64("user\@domain");'
dXNlckBkb21haW4= 
$ perl -MMIME::Base64 -e 'print encode_base64("password");'
 cGFzc3dvcmQ=

 

Please make sure you use a '\' to escape the @ symbol in any username otherwise perl may interpret it.

Now connect to the mail server using telnet

 

telnet mailserver.com 25

 

Once the server has sent a greeting (220) reply as below replacing "example.com" with the hostname of your computer.

 

EHLO example.com

 

The server should then reply back and the AUTH line must include the text LOGIN (i.e. 250-AUTH PLAIN LOGIN).

You now need to tell the server you wish to authenticate with it so send the following.

 

AUTH LOGIN

 

The server should then reply with "334 VXNlcm5hbWU6" (which is "Username:" base64 encoded) and to this paste in the username prepared above for example.

dXNlckBkb21haW4=

The server will again reply this time with "334 UGFzc3dvcmQ6" (which is "Password:" base64 encoded) and to this paste in the password prepared above for example.

cGFzc3dvcmQ=

If the username and password were both accepted you should then see

235 Authentication succeeded

If this is not the reply then you may have a problem with your email credentials.

Tags: authentication, perl, smtp, smtpauth, telnet
Last update:
2014-12-16 21:41
Author:
Chris Burton
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags