To send an email via telnet just type:
root:~# telnet 172.16.12.25 25
220 hostname.com Internet Agent 0.0.3
250 hostname.com Ok
MAIL FROM: firstname.lastname@example.org
RCPT TO: them@hostname_away.com
354 Enter mail, end with "." on a line by itself
ie, type your message or whatever
221 hostname.com Closing transmission channel
Connection to host lost.
By the way, you will not see any AUTH listed when connecting and doing an ehlo. In addition any attempt to auth will be met with the error:
035.5.1 Error: authentication not enabled
It will not display options for smtp authentication unless a TLS security is used to connect.
Try connecting with:
openssl s_client -connect localhost:25 -starttls smtp
Now you will see the 250-AUTH PLAIN LOGIN on ehlo and you will be able to auth.
When posting logs of the SASL negotiations to public lists, please keep in mind that username/password information is trivial to recover from the base64-encoded form.
You can use one of the following commands to generate base64 encoded authentication information:
Using a recent version of the bash shell:
echo -ne '00username00password' | openssl base64
Some other shells support similar syntax.
Using the printf command:
printf '%s%s' 'username' 'password' | openssl base64
printf '%s%s' 'username' 'password' | mmencode
The mmencode command is part of the metamail software.
root:~# openssl s_client -connect 4network.eu:25 -starttls smtp
and the output:
Compression: 1 (zlib compression)
Start Time: 1373377800
Timeout : 300 (sec)
Verify return code: 18 (self signed certificate)
and then type:
250-AUTH PLAIN LOGIN
auth plain AGpvbGFudGEAam9sYW50YQ==
235 2.7.0 Authentication successful
SMTP Status Codes
You may notice along the way that after typing commands you see responses from the server starting with “250″. 250 is a good thing, and there are a lot of other SMTP status codes you’ll encounter the more you use this technique.
Continue reading “Send an email via telnet.”