RSS feed logo RSS Feed | About Pantz.org
Send mail through an SMTP server using telnet
Posted on 02-22-2003 21:13:00 EST | Updated on 02-22-2003 21:13:00 EST
Section: /software/smtp/ | Permanent Link

This is quick writeup which describes connecting to a mail server and sending a test message using telnet.

Telnet to the mail server.

telnet mail.somedomain.com 25

You should recieve a reply to this effect.

Trying 10.10.10.10...
Connected to mail.somedomain.com.
Escape character is '^]'.
220 mail.somedomain.com ESMTP Exim 4.04 Wed, 13 Nov 2002 16:27:42 -0700

Then send your HELO command.

HELO mail.someotherdomain.com

You should get back something to the effect of this.

250 mail.somedomain.com Hello mail.someotherdomain.com [10.10.10.20]

Now send your "From" command. This is the person the e-mail is from.

MAIL FROM:<Jim@someotherdomain.com>

You should get the following back.

250 OK

Then send your RCPT command. This is the person recieving the e-mail.

RCPT TO:<Joe@somedomain.com>

You should get the following back.

250 OK

Then send your DATA command. This is the body of your e-mail.

DATA

You should get back something from the server that looks like this.

354 Enter message, ending with "." on a line by itself

Now to create the body of the message. Put in the subject line and the message. Then put a period by itself as the last line and hit the "enter" key to finish.

Subject:Test Message
This is a test message.
.

You will get a message back from the server saying your message was accepted (queued).

250 OK: queued as 18C6vd0005Ey-00

Then type your last command to finish your session.

QUIT

You will see the connection end

221 mailhub.somedomain.com closing connection Connection closed by foreign host

Del.icio.us! | Digg Me! | Reddit!

Related stories