Software & Finance

Visual C++ - Send Email Using Telnet

Although there is no coding necesary on this page, we use telnet a lot test the socket programming application.

How do you send an email using Telnet? It is easy once you can remember the SMTP Client protocol steps.

First you need to find out the SMTP server address for the domain. Let's find out the SMTP server address for

Goto MS Dos prompt and type nslookup command.

> set q=mx

Non-authoritative answer:       MX preference = 30, mail exchanger =       MX preference = 20, mail exchanger =       MX preference = 5, mail exchanger =       MX preference = 10, mail exchanger =       MX preference = 40, mail exchanger =

Then exit nslookup command by pressing Ctrl+C.

Now connect to gmail SMTP server with Telnet by typing the following command on the command prompt.

c:\> telnet 25

220 ESMTP t15si14936218ibf.58
helo kathir
250 at your service
mail from: <>
250 2.1.0 OK t15si14936218ibf.58
rcpt to: <>
250 2.1.5 OK t15si14936218ibf.58
354  Go ahead t15si14936218ibf.58
from: kathir
to: kathir
subject: hi from kathir

This is for testing

250 2.0.0 OK 1287958967 t15si14936218ibf.58

Source Code

No Coding Necessary