DNS and Networking Tools

How to use SMTP commands

1. Open telnet session to the mail server with port 25 (SMTP):

# telnet mail.example.com 25
220 mail.example.com ESMTP

2. Type the helo command with your domain name:

# helo yourdomain.com
250 mail.example.com

3. Type the sender e-mail address:

# mail from: yourname@yourdomain.com
250 2.1.0 Ok

4. Type the recipient e-mail address:

# rcpt to: webmaster@example.com
250 2.1.5 Ok

5. Type the data command to start enter the mail body:

# data
354 End data with .

6. Type the message body text:

# this is a test

7. To end the message and send the e-mail end with "." (Dot):

# .
250 2.0.0 Ok: queued as 189C81BB315

8. Finish and close the SMTP sessions:

# quit
221 2.0.0 Bye

Complete session output:

# telnet mail.example.com 25
220 mail.example.com ESMTP
#helo yourdomain.com
250 mail.example.com
# mail from: yourname@yourdomain.com
250 2.1.0 Ok
# rcpt to: webmaster@example.com
250 2.1.5 Ok
# data
354 End data with .
# this is a test
# .
250 2.0.0 Ok: queued as 189C81BB315
# quit
221 2.0.0 Bye