{"id":1755,"date":"2016-05-02T22:04:19","date_gmt":"2016-05-03T03:04:19","guid":{"rendered":"http:\/\/swildow.darktech.org\/wp\/?p=1755"},"modified":"2016-05-02T22:05:15","modified_gmt":"2016-05-03T03:05:15","slug":"how-to-test-smtp-auth-using-telnet","status":"publish","type":"post","link":"https:\/\/www.wildow.com\/blog\/?p=1755","title":{"rendered":"How to Test SMTP AUTH using Telnet"},"content":{"rendered":"<h1 id=\"how-to-test-smtp-auth-using-telnet\" class=\"sectionedit1\"><a title=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet\" target=\"_blank\">How to Test SMTP AUTH using Telnet<\/a><\/h1>\n<div class=\"level1\">\n<p>Below are instructions on how to test <abbr title=\"\" data-original-title=\"Simple Mail Transfer Protocol\">SMTP<\/abbr> AUTH against a mail server using Telnet and entering the commands by hand.<\/p>\n<p>The first thing you need to do is get a base64 encoding of your username and password. There are a couple ways to do this, the example below uses <abbr title=\"\" data-original-title=\"Practical Extraction and Report Language\">Perl<\/abbr>:<\/p>\n<p>website to help with conversion:\u00a0 <a href=\"http:\/\/www.hcidata.info\/base64.htm\" target=\"_blank\">http:\/\/www.hcidata.info\/base64.htm<\/a><\/p>\n<p>@ symbol was messing with perl<\/p>\n<div>\n<div id=\"highlighter_806852\" class=\"syntaxhighlighter  shell\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<\/td>\n<td class=\"code sorttable_sorted_reverse\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"shell plain\">perl -MMIME::Base64 -e <\/code><code class=\"shell string\">'print encode_base64(\"username\");'<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"shell plain\">perl -MMIME::Base64 -e <\/code><code class=\"shell string\">'print encode_base64(\"password\");'<\/code><\/div>\n<\/div>\n<p><span id=\"sorttable_sortrevind\">\u00a0\u25b4<\/span><\/td>\n<\/tr>\n<\/thead>\n<tfoot><\/tfoot>\n<\/table>\n<\/div>\n<\/div>\n<p>What will be returned from each command is a base64 encoding of the username and password; save these as you will need them later. Now connect to the mail server using Telnet:<\/p>\n<div>\n<div id=\"highlighter_768749\" class=\"syntaxhighlighter  shell\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"shell plain\">telnet mailserver.com 25<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/thead>\n<tfoot><\/tfoot>\n<\/table>\n<\/div>\n<\/div>\n<p>Greet the mail server:<\/p>\n<div>\n<div id=\"highlighter_958067\" class=\"syntaxhighlighter  shell\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"shell plain\">EHLO mailserver.com<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/thead>\n<tfoot><\/tfoot>\n<\/table>\n<\/div>\n<\/div>\n<p>Tell the server you want to authenticate with it:<\/p>\n<div>\n<div id=\"highlighter_634931\" class=\"syntaxhighlighter  shell\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"shell plain\">AUTH LOGIN<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/thead>\n<tfoot><\/tfoot>\n<\/table>\n<\/div>\n<\/div>\n<p>The server should have returned <code class=\"inline\">334 VXNlcm5hbWU6;<\/code> this is a base64 encoded string asking you for your username, paste the base64 encoded username you created earlier, example:<\/p>\n<div>\n<div id=\"highlighter_526824\" class=\"syntaxhighlighter  plain\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">dXNlcm5hbWUuY29t<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/thead>\n<tfoot><\/tfoot>\n<\/table>\n<\/div>\n<\/div>\n<p>Now the server should have returned <code class=\"inline\">334 UGFzc3dvcmQ6;<\/code>. Again this is a base64 encoded string now asking for your password, paste the base64 encoded password you created, example:<\/p>\n<div>\n<div id=\"highlighter_717956\" class=\"syntaxhighlighter  plain\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">bXlwYXNzd29yZA==<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/thead>\n<tfoot><\/tfoot>\n<\/table>\n<\/div>\n<\/div>\n<p>Now you should have received a message telling you that you successfully authenticated. If it failed your user\/pass may have been wrong or your mailserver is broken.<\/p>\n<p>Below is a log of a real successful <abbr title=\"\" data-original-title=\"Simple Mail Transfer Protocol\">SMTP<\/abbr> AUTH connection over Telnet:<\/p>\n<div>\n<div id=\"highlighter_647270\" class=\"syntaxhighlighter  plain\">\n<div class=\"toolbar\"><a class=\"toolbar_item command_help help\" href=\"https:\/\/www.ndchost.com\/wiki\/mail\/test-smtp-auth-telnet#\">?<\/a><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<div class=\"line number16 index15 alt1\">16<\/div>\n<div class=\"line number17 index16 alt2\">17<\/div>\n<div class=\"line number18 index17 alt1\">18<\/div>\n<div class=\"line number19 index18 alt2\">19<\/div>\n<div class=\"line number20 index19 alt1\">20<\/div>\n<div class=\"line number21 index20 alt2\">21<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">user@localhost [~]# telnet exampledomain.com 25<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain plain\">Trying 1.1.1.1...<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain plain\">Connected to exampledomain.com (1.1.1.1).<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">Escape character is '^]'.<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"plain plain\">220-server1.exampledomain.com ESMTP Exim 4.66 #1 Wed, 09 May 2007 23:55:12 +0200<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"plain plain\">220-We do not authorize the use of this system to transport unsolicited,<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"plain plain\">220 and\/or bulk e-mail.<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"plain plain\">EHLO exampledomain.com<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"plain plain\">250-server1.exampledomain.com Hello\u00a0 [1.1.1.2]<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"plain plain\">250-SIZE 52428800<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"plain plain\">250-PIPELINING<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"plain plain\">250-AUTH PLAIN LOGIN<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"plain plain\">250-STARTTLS<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"plain plain\">250 HELP<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"plain plain\">AUTH LOGIN<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"plain plain\">334 VXNlcm5hbWU6<\/code><\/div>\n<div class=\"line number17 index16 alt2\"><code class=\"plain plain\">dXNlcm5hbWUuY29t<\/code><\/div>\n<div class=\"line number18 index17 alt1\"><code class=\"plain plain\">334 UGFzc3dvcmQ6<\/code><\/div>\n<div class=\"line number19 index18 alt2\"><code class=\"plain plain\">bXlwYXNzd29yZA==<\/code><\/div>\n<div class=\"line number20 index19 alt1\"><\/div>\n<div class=\"line number21 index20 alt2\"><code class=\"plain plain\">235 Authentication succeeded<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/thead>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to Test SMTP AUTH using Telnet Below are instructions on how to test SMTP AUTH against a mail server using Telnet and entering the commands by hand. The first thing you need to do is get a base64 encoding &#8230; <a class=\"more-link\" href=\"https:\/\/www.wildow.com\/blog\/?p=1755\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1755","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1755"}],"version-history":[{"count":2,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1755\/revisions"}],"predecessor-version":[{"id":1757,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1755\/revisions\/1757"}],"wp:attachment":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}