Test SMTP authentication with TELNET
Prerequisites:
1) SMTP server address and port: smtp.example.com:25
2) Your local hostname. Not crucial at most cases, but better use the DNS name. I’ll use mymailclient.comin this tutorial.
3) Base64 encoder. Choose the one suits you better:
- Online form: http://www.opinionatedgeek.com/dotnet/tools/base64encode/, or any other online form of your choice.
- Software like: http://www.slavasoft.com/hashcalc/index.htm, or any other software of form of your choice.
4) Login details encoded in base 64:
- Username: user@example.com -> encoded in base64: dXNlckBleGFtcGxlLmNvbQ==
- Password: XXXXX -> encoded in base64: YWJjMTIz
The session:
Basically all you need is to open a telnet conection to the right server on the right port. The following example is totally forged. NO REAL DATA USED!!!!
Q: C:\>telnet smtp.example.com 25
A: Connected to smtp.example.com (1.1.1.1).
A: Escape character is '^]'.
A: 220- smtp.example.com ESMTP Exim 4.66 #1 Wed, 09 May 2007 23:55:12 +0200
A: 220-We do not authorize the use of this system to transport unsolicited,
A: 220 and/or bulk e-mail.
Q: EHLO mymailclient.com
_________
If you are testing a server that doesn’t require AUTH do:
Q: HELO mymailclient.com
And continue to Section 2
_________
A: 250-server1.exampledomain.com Hello [1.1.1.2]
A: 250-SIZE 52428800
A: 250-PIPELINING
A: 250-AUTH PLAIN LOGIN
A: 250-STARTTLS
A: 250 HELP
Q: AUTH LOGIN
A: 334 VXNlcm5hb3WU6
Q: dXNlckBleGFtcGx2lLmNvbQ==
This is your base64 encoded username
A: 334 UGFzc3dvcmQ^6
Q: YWJjMTIz
This is your base64 encoded password
A: 235 Authentication succeeded
Section 2: Sending the Email
If you got here by passing the austhentication just continue the command in same session.
Q: MAIL FROM: test@test.com
A: 250 MAIL FROM accepted
Q: RCPT TO: test@test.com
A: 250 RCPT TO accepted
Q: DATA
A: 354 continue. finished with "\r\n.\r\n"
Q: Cc: test@test.com
Subject: Testing SMTP auth by telnet.
Hello,
Do not reply.
.
A: 250 OK TrackingID:5e14523646-8dab-42dd-b2cc-5a20413ed295
Congratulations, you just sent an email using telnet!