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 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
250 mx.google.com at your service
mail from: <email@example.com>
250 2.1.0 OK t15si14936218ibf.58
rcpt to: <firstname.lastname@example.org>
250 2.1.5 OK t15si14936218ibf.58
354 Go ahead t15si14936218ibf.58
subject: hi from kathir
This is for testing
250 2.0.0 OK 1287958967 t15si14936218ibf.58
No Coding Necessary