Aug 10, 2018

How to Debug SMTP from command line

Debug Email by Telnet

[[email protected] ~]$ telnet mail.i88.ca 25
Trying 192.168.1.90...
Connected to 192.168.1.90.
Escape character is '^]'.

220 mail.i88.ca ESMTP service ready
(The first command we need to issue to the mail server is the EHLO or HELO.  This is a basic greeting that starts the communication between the telnet client and the SMTP server.  Also passed is the DNS PTR for the IP address from which we are connecting as determined previously.
EHLO ptr.of.your.ip)
EHLO your.domain
250 mail.i88.ca Hello your.domain [192.168.1.100]

(The next command we need to issue is the MAIL FROM command.  This determines the address to which bounces are sent.  This is not the same as the from header, which is the email address shown in an email client.)
MAIL FROM: Superman@i88.ca
250 OK
RCPT TO: another-Superman@i88.ca
250 Accepted
DATA
354 send message
From: "John Smith" <[email protected]>
To: "Jane Doe" <[email protected]>
Subject: test message sent from manual telnet session        

input your content here.
.
("." to end the content)

250 2.6.0 message received
quit
221 mail.i88.ca closing connection

See also:Test SMTP AUTH using Telnet

An email may be submitted to an SMTP server using:


nc localhost 25 << EOF

EHLO mail.i88.ca
MAIL FROM: [email protected]
DATA
Subject: test message sent from manual telnet session
Body of email.
.
QUIT
EOF