SMTP - send an email using telnet

From Ever changing code

You can send an email using native SMTP commands while connecting to a mail server using Telnet connection. In the script below text in bold are the commands followed a space then free form string appropriate to the preceding command.

telnet 25
220 Microsoft ESMTP MAIL Service, Version: 7.5.7601.17514 ready at  Thu, 31 Mar 2016 13:53:42 +0100
250 Hello []
mail from:   <- this need to be valid address, otherwise you'll get:501 5.5.4 Invalid Address
250 2.1.0 OK 
rcpt to:
250 2.1.5
354 Start mail input; end with <CRLF>.<CRLF>
from: Piotr
to: me
Subject: Test via telenet
              <- [enter] may also require a space
test body
              <- [enter] may also require a space
.  <-- the '.' dot is important as indicates EndOfMessage
250 2.6.0 <> Queued mail for delivery

Depends on your mail server the commands need to be in upper cases like HELO etc, the above was tested using Microsoft implementation.