Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
mail:test-smtp-auth-telnet [2011-07-01 19:06:50]
garrett.plasky Approved
mail:test-smtp-auth-telnet [2017-01-04 18:01:49] (current)
rory.blanchard
Line 4: Line 4:
 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 Perl: 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 Perl:
  
-<sxh shell>perl -MMIME::Base64 -e 'print encode_base64("username");' +<code> 
-perl -MMIME::Base64 -e 'print encode_base64("password");'</sxh>+perl -MMIME::Base64 -e 'print encode_base64("username");' 
 +perl -MMIME::Base64 -e 'print encode_base64("password");' 
 +</code>
  
 +<note>
 +If you have any special characters such as @ or ' or ! you must put \ in front of it to escape the character.
 +</note>
 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: 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:
  
-<sxh shell>telnet mailserver.com 25</sxh>+<code> 
 +telnet mailserver.com 25 
 +</code>
  
 Greet the mail server: Greet the mail server:
  
-<sxh shell>EHLO mailserver.com</sxh>+<code> 
 +EHLO mailserver.com 
 +</code>
  
 Tell the server you want to authenticate with it: Tell the server you want to authenticate with it:
  
-<sxh shell>AUTH LOGIN</sxh>+<code> 
 +AUTH LOGIN 
 +</code>
  
 The server should have returned <c>334 VXNlcm5hbWU6;</c> this is a base64 encoded string asking you for your username, paste the base64 encoded username you created earlier, example: The server should have returned <c>334 VXNlcm5hbWU6;</c> this is a base64 encoded string asking you for your username, paste the base64 encoded username you created earlier, example:
  
  
-<sxh plain>dXNlcm5hbWUuY29t</sxh>+<code> 
 +dXNlcm5hbWUuY29t 
 +</code>
  
 Now the server should have returned <c>334 UGFzc3dvcmQ6;</c>. Again this is a base64 encoded string now asking for your password, paste the base64 encoded password you created, example: Now the server should have returned <c>334 UGFzc3dvcmQ6;</c>. Again this is a base64 encoded string now asking for your password, paste the base64 encoded password you created, example:
  
  
-<sxh plain>bXlwYXNzd29yZA==</sxh>+<code> 
 +bXlwYXNzd29yZA== 
 +</code>
  
 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.  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. 
Line 33: Line 48:
 Below is a log of a real successful SMTP AUTH connection over Telnet: Below is a log of a real successful SMTP AUTH connection over Telnet:
  
-<sxh plain>user@localhost [~]# telnet exampledomain.com 25+<code>user@localhost [~]# telnet exampledomain.com 25
 Trying 1.1.1.1... Trying 1.1.1.1...
 Connected to exampledomain.com (1.1.1.1). Connected to exampledomain.com (1.1.1.1).
Line 53: Line 68:
 bXlwYXNzd29yZA== bXlwYXNzd29yZA==
  
-235 Authentication succeeded</sxh>+235 Authentication succeeded 
 +</code>
  
 {{tag>how-to smtp}} {{tag>how-to smtp}}