SMTP connection using telnet
Did you ever need to test a SMTP server quickly?
If the answer is yes, probably you had hear something about using telnet to send emails directly.
I've used this trick a thousand times myself, but I always forget the correct commands and the order I have to provide them to the SMTP server.
Transcription follows:
[Fenris] ~> telnet mail.e-shell.org 25 Trying 212.89.9.184... Connected to mail.e-shell.org. Escape character is '^]'. 220 [ ESMTP Codigo23 mail server ] - [ Will Hack Unix for food ] ehlo localhost 250-Frey.e-shell.org Hello cm82227.red.mundo-r.com [213.60.82.227], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 5242880 250-DSN 250-STARTTLS 250-DELIVERBY 250 HELP mail from: you@yahoo.com 250 2.1.0 you@yahoo.com... Sender ok rcpt to: jarjarthisisnotmymail@e-shell.org 250 2.1.5 jarjarthisisnotmymail@e-shell.org... Recipient ok data 354 Enter mail, end with "." on a line by itself This is a sample mail sent to you via telnet! . 250 2.0.0 m6AB3LDP071599 Message accepted for delivery
Explanation:
1- Connect to the server using telnet:
telnet mail.e-shell.org 25
2- Say hello to the server:
ehlo localhost
3- Tell the server who is sending the email:
mail from: you@yahoo.com
4- Then tell it the destination address:
rcpt to: jarjarthisisnotmymail@e-shell.org
5- Finally tell the server you are about to write the message contents:
dataNOTE: If you want to add a subject to your mail, just add a line like:
Subject: this is my subjectat the beginning of the body. You will need to press enter twice for it to work properly.
6- Once you are done, push enter, then add a single dot (.) and push enter again.
7- Mail sent!
(Anyone who can teach us how to do that using netcat??)