Test SMTP Server via Telnet

As a developer I always have to write code to send emails, here's a quick way as a developer to make sure the SMTP Server is working properly.

Telnet to Port 25 to Test SMTP Communication

1. Telnet into Exchange or SMTP Server using port 25.
Command is telnet <servername> 25

c:\>telnet 192.168.0.5 25220 fredmastro.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at  Sun, 29 Nov 2009 10:22:22 -0400

2.Start by typing the following:

helo <your domain name><enter>                 

response should be as follows

250 OK

 

c:\>helo250 fredmastro.com Hello [10.x.x.x]

3. Type the following command to tell the receiving SMTP server who the message is from:

mail from: <your Email Address><enter>
response should be as follows

250 OK - mail from <your Email address>


For example,

c:\>mail from: fredmastro@fredmastro.com250 2.1.0 fredmastro@fredmastro.com....Sender OK


4.Type the following command to tell the receiving SMTP server whom the message is to. Use a valid recipient SMTP address in the domain that you are sending to.

For example, if you are sending to someguy@gmail.com, you must be certain that someguy@gmail.com exists in your domain. Otherwise, you will receive an NDR.

rcpt to: <recipient address><enter>

response should be as follows

250 OK - Recipient <recipient address>

For example, c:\>rcpt to: someguy@gmail.com250 2.1.5 someguy@gmail.com

5.Type the following command to tell the SMTP server that you are ready to send data:

data<enter>
response should be as follows

354 Send data.  End with CRLF.CRLF

c:\>data354 Start mail input; end with <CRLF>.<CRLF>Test Message.

250 2.6.0 <someguy@gmail.com> Queued mail for delivery

6. Close the connection by typing the following command:

c:\>QUIT

response should be as follows:
221 closing connection

Another good reference: http://www.messagingtalk.org/content/470.html

Casting Types in VB.Net and More

Quick Enum Snippet. Get Values or Names based on Name or Value