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.
[Fenris] ~> telnet mail.e-shell.org 25 Trying 126.96.36.199... 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 [188.8.131.52], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 5242880 250-DSN 250-STARTTLS 250-DELIVERBY 250 HELP mail from: email@example.com 250 2.1.0 firstname.lastname@example.org... Sender ok rcpt to: email@example.com 250 2.1.5 firstname.lastname@example.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
1- Connect to the server using telnet:
telnet mail.e-shell.org 25
2- Say hello to the server:
3- Tell the server who is sending the email:
mail from: email@example.com
4- Then tell it the destination address:
rcpt to: firstname.lastname@example.org
5- Finally tell the server you are about to write the message contents:
NOTE: If you want to add a subject to your mail, just add a line like:Subject: this is my subject
at 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??)