How do I test SMTP Auth using telnet?

Chris Burton
2014-12-16 21:41


Prepare the username and password by encoding them as follows:


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


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 25


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




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.




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


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.


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
Average rating: 0 (0 Votes)

You cannot comment on this entry