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 gmail.com

Goto MS Dos prompt and type nslookup command.

> set q=mx
> gmail.com

Non-authoritative answer:
gmail.com       MX preference = 30, mail exchanger =     
gmail.com       MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com
gmail.com       MX preference = 5, mail exchanger = gmail-smtp-in.l.google.com
gmail.com       MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com
gmail.com       MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com
>

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 alt3.gmail-smtp-in.l.google.com 25

220 mx.google.com ESMTP t15si14936218ibf.58
helo kathir
250 mx.google.com at your service
mail from: <kathirusa@yahoo.com>
250 2.1.0 OK t15si14936218ibf.58
rcpt to: <kathircpp@gmail.com>
250 2.1.5 OK t15si14936218ibf.58
data
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

 

Output


 

None