$ telnet remotehost 25
HELO localhost
MAIL FROM: johndoe@localhost
RCPT TO: jilldoe@remotehost
DATA
Subject:Test Message
This is a test message.
.
QUIT
Sending mail to a SMTP server using telnet
Submitted by sandip on Fri, 05/04/2007 - 14:15
»
- sandip's blog
- Login or register to post comments
smtp auth checking
Generate base64 encoded authentication string:
echo -ne '\000username\000password' | openssl enc -base64
or with perl:
perl -MMIME::Base64 -e 'print encode_base64("\000username\000password");'
Replace the username and password respectively. "\000" is a null byte character used as the separator between username and password:
It prints something like:
AHVzZXJuYW1lAHBhc3N3b3Jk
Copy that string and simulate a login session:
telnet remotehost 25
Example session transcript is below (bold is to be typed):
"OK Authenticated" would mean the authentication was successful.
Since the server offer "STARTTLS" session, to test TLS encrypted session, use openssl instead of telnet:
openssl s_client -connect {remotehost}:25 -starttls smtp