SMTP commands (sending mail using telnet, a good way to test how a mail server is accepting your mail)

To help diagnose if a mail server is acting as you expect when trying to send an email using the TELNET command.

telnet mail.domain.test 25
HELO local.domain.name
MAIL FROM: mail@domain.test
RCPT TO: mail@otherdomain.test
DATA
Subject:-type subject here- then press enter twice (RFC 882)
type the body of your message
“.” on a line on it’s own.
QUIT

 

 
In more detail….


To help diagnose if a mail server is acting as you expect when trying to send an email.telnet mail.domain.test 25

220 mail.domain.test ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?
You will then need to delcare where you are sending the email from:

HELO local.domain.name

you should use your FQDN, the mail server has no choice but to take your word for it as of RFC822-RFC1123.

250 mail.domain.test Hello local.domain.name [your ip address], pleased to meet you

Now give your email address:

MAIL FROM: mail@domain.test

250 2.1.0 mail@domain.test… Sender ok

Now give the recipients address:

RCPT TO: mail@otherdomain.test

250 2.1.0 mail@otherdomain.test… Recipient ok

DATA

Subject:-type subject here- then press enter twice (RFC 882)

type the body of your message

To tell the mail server that you have completed the message enter a single “.” on a line on it’s own.

250 2.0.0 ???????? Message accepted for delivery

QUIT

221 2.0.0 mail.domain.test closing connection
Connection closed by foreign host