الأربعاء، 28 مارس 2012

Network Assignment

Now it's time to send the email.

In windows, go to start=>run=>cmd
Once the command line is opened write the following: telnet localhost 2301
>telnet smtp.gmail.com 25
you should see the following:
220 mx.google.com ESMTP f14sm1400408wbe.2

we send a hello message:
helo google
250 mx.google.com at your service
ehlo google
250-mx.google.com at your service, [212.28.228.49]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250 ENHANCEDSTATUSCODES

Then the authentication request:
 AUTH LOGIN
334 VXNlcm5hbWU6

Now we have to authenticate by using our gmail address and password.
However since this is an encrypted session, we're gonna have to send the email and password encrypted in base64. To encrypt your email and password, you can use a program or an online website to encrypt it (search on google for: base64 online encryption).
For example the sentence "my email address" in base64 will become: bXkgZW1haWwgYWRkcmVzcw==
and the word "password" will become: cGFzc3dvcmQ=

Now you should have your email address and password encrypted in base64, go back to the command line and write your base64 email first, (I will use "my email address" as my email address and "password" as my password for this example):
bXkgZW1haWwgYWRkcmVzcw==
334 UGFzc3dvcmQ6

Enter your password:
cGFzc3dvcmQ=
235 2.7.0 Accepted

Enter your email:
MAIL FROM:<etienne.rached@gmail.com>
250 2.1.0 OK x23sm1104292weq.10

Enter the recipient email (I'll email myself for testing):
RCPT TO:<etienne.rached@gmail.com>
250 2.1.5 OK x23sm1104292weq.10
 
Now comes the message part:
DATA
354  Go ahead x23sm1104292weq.10
From: Etienne <etienne.rached@gmail.com>
To: Meeeeeeee <etienne.rached@gmail.com>
Subject: Testing email from telnet
This is the body

Adding more lines to the body message.
Finish the DATA with a dot:
.
250 2.0.0 OK 1288307376 x23sm1104292weq.10


And quit:

QUIT
221 2.0.0 closing connection x23sm1104292weq.10
Connection to host lost.

The email should now be sent and you can find it in your "sent mail" in your gmail.


Using Telnet with stunnel is very easy, I will try and show how to receive an email with pop3 using telnet, and how to send an email using TLS in my future posts.

Hope you enjoyed this one :)
this is assignment just convert it to your programming language

ليست هناك تعليقات:

إرسال تعليق