Unfortunately, since I have to use a Windows server, I was not able to get openssl to work as the answer above suggests.
However, I managed to get a similar program called stunnel (which can be downloaded from here ) to work. I got the idea from www.tech-and-dev.com , but I had to change the instructions a bit. Here is what I did:
- Install the telnet client in the window window.
- Download stunnel. (I downloaded and installed a file called stunnel-4.56-installer.exe).
- After installation, you need to find the configuration file
stunnel.conf , which in my case I installed in C:\Program Files (x86)\stunnel Then you need to open this file in a text editor such as notepad. Locate [gmail-smtp] and delete the semicolon on the client line below (in the stunnel.conf file, each line starting with a semicolon is a comment). You should get something like:
[gmail-smtp] client = yes accept = 127.0.0.1:25 connect = smtp.gmail.com:465
After that, save the stunnel.conf file and reload the configuration (for this, use the stunnel GUI program and click on configuration => Reload).
You should now be ready to send email in the telnet windows client!
Go to Start => run => cmd.
As soon as cmd opens in the following form and press Enter:
telnet localhost 25
Then you should see something similar to the following:
220 mx.google.com ESMTP f14sm1400408wbe.2
Then you need to answer by typing the following and pressing enter:
helo google
This should give you the following answer:
250 mx.google.com at your service
If you get this, you need to enter the following and press enter:
ehlo google
Then you will get the following answer:
250-mx.google.com at your service, [212.28.228.49] 250-SIZE 35651584 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH 250 ENHANCEDSTATUSCODES
You should now be ready to authenticate with your Gmail data. To do this, enter the following and press enter:
AUTH LOGIN
Then you will get the following answer:
334 VXNlcm5hbWU6
This means that we are ready to authenticate using our gmail address and password.
However, since this is an encrypted session, we will need to send an email and password encoded in base64. To encode your email and password, you can use the converter program or an online website to encode it (for example, base64 or google search for base64 online encoding). I recommend that you do not touch the cmd / telnet session before you do this.
For example, test@gmail.com will become dGVzdEBnbWFpbC5jb20 = and the password will become cGFzc3dvcmQ =
Once you have made this copy and paste the converted base64 username into the cmd / telnet session and press enter. This should give you the following answer:
334 UGFzc3dvcmQ6
Now copy and paste the converted base64 password into the cmd / telnet session and press enter. This should give you the following answer if both credentials are correct:
235 2.7.0 Accepted
Now you must enter the sender address (it must match the username) in the following format and press enter:
MAIL FROM:<test@gmail.com>
This should give you the following answer:
250 2.1.0 OK x23sm1104292weq.10
Now you can enter the recipient's email address in the same format and press enter:
RCPT TO:<recipient@gmail.com>
This should give you the following answer:
250 2.1.5 OK x23sm1104292weq.10
Now you need to enter the following and press enter:
DATA
Which should give you the following answer:
354 Go ahead x23sm1104292weq.10
Now we can start composing a message! To do this, enter your message in the following format ( Tip : do this in notepad and copy the entire message to the cmd / telnet session):
From: Test <test@gmail.com> To: Me <recipient@gmail.com> Subject: Testing email from telnet This is the body Adding more lines to the body message.
When you finish writing, enter a period:
.
This should give you the following answer:
250 2.0.0 OK 1288307376 x23sm1104292weq.10
And now you need to end the session by typing the following and pressing enter:
QUIT
This should give you the following answer:
221 2.0.0 closing connection x23sm1104292weq.10 Connection to host lost.
Your email should now be in the recipient's inbox!