Syntax for establishing a raw network connection using telnet is this:
telnet {domain_name} {port_number}
So telnet to your SMTP server like
telnet smtp.mydomain.example 25
And copy and paste the below
helo client.mydomain.example
mail from:<sender@mydomain.example>
rcpt to:<to_email@mydomain.example>
data
From: test@mydomain.example
Subject: test mail from command line
this is test number 1
sent from linux box
.
quit
Note : Do not forgot the “.” at the end which represents the end of the message.
The “quit” line exits ends the session.