Netcat /
Sending Mail with netcat
Here's how to send a letter using netcat:
$ nc example.com 25 220 example.com ESMTP OpenSMTPD
Next, we type HELO followed by our sending domain:
HELO example.com 250 example.com Hello example.com [38.81.163.143], pleased to meet you
Afterwards, we type our sending mail address:
MAIL FROM: <from@example.com> 250 2.0.0 Ok
And the destination mail address:
RCPT TO: <to@example.com> 250 2.1.5 Destination address valid: Recipient ok
Then we type DATA followed by our email:
DATA 354 Enter mail, end with "." on a line by itself Subject: Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel
We then type . to end the email, then QUIT:
. 250 2.0.0 e57f9a36 Message accepted for delivery QUIT 221 2.0.0 Bye
Here's the complete process:
$ nc example.com 25 220 example.com ESMTP OpenSMTPD HELO example.com 250 example.com Hello example.com [38.81.163.143], pleased to meet you MAIL FROM: <from@example.com> 250 2.0.0 Ok RCPT TO: <to@example.com> 250 2.1.5 Destination address valid: Recipient ok DATA 354 Enter mail, end with "." on a line by itself Subject: Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel . 250 2.0.0 e57f9a36 Message accepted for delivery QUIT 221 2.0.0 Bye