Telnet and SMTP - how to send email using telnet commands

Monday, 28 September 2009 23:06 by myro

What is the best place to keep telnet commands used to test a SMTP service than you personal blog? Laughing
Communication between clients and SMTP services happens using simple text commands and after each commend sent by the client, the SMTP server replies with a response code followed by a message.
You can use these commands to test if your SMTP is running correcly and compare them with my SMTP's conversation to see what the server should reply.
As you will see my SMTP service is installed into a windows enviroment using IIS 6.0 and with the NTLM authentication enabled.
Let's see first few besic commands:

Command Example Description
HELO (now EHLO) EHLO 193.56.47.125 Identification using the IP address or domain name of the originator computer
MAIL FROM: MAIL FROM: originator@domain.com Identification of the originator's address
RCPT TO: RCPT TO: recipient@domain.com Identification of the recipient's address
DATA DATA message Email body
QUIT QUIT Exit the SMTP server
HELP HELP List of SMTP commands supported by the server
AUTH LOGIN
AUTH LOGIN Authenticates you user

And now, see how can you use these commands with a SMTP server.

telnet mail.server.com 25
Trying 70.87.xxx.xxx...
Connected to mail.server.com.
Escape character is '^]'.
220 C34495-51701 Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Fri, 25 Sep 2009 14:27:48 +0200
ehlo myrocode.com
250-C34495-51701 Hello [93.62.0.xxx]
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250 OK
auth login
334 VXNlcm57uWU6
aXBlcmJvcmVh
334 UFFzc3dzcmQ7
aXBlcmIwMSE=
235 2.7.0 Authentication successful
mail from:miro@miro.com
250 2.1.0 miro@miro.com....Sender OK
rcpt to:test@myrocode.com
250 2.1.5 test@myrocode.com
data
354 Start mail input; end with <CRLF>.<CRLF>
ciaooooo
.
250 2.6.0 <C34495-51701DcBi4FS00000001@C34495-51701> Queued mail for delivery
quit
Connection closed by foreign host.

An important part of this communication is when it come's to autenticate your user: after AUTH LOGIN is send, you should provide first the username and then the password, both encoded using the base64 algoritam.
you can encode a string into a base64 format follwing this link

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Developer Life
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed

Greetings to my best fan

Wednesday, 8 July 2009 12:24 by myro

This post is just a greeting to one of my best fans: Cyb3rking.

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Developer Life
Actions:   Bookmark and Share | Permalink | Comments (2) | Comment RSSRSS comment feed

myrocode is now on twitter

Tuesday, 7 July 2009 11:21 by myro

Now my folks can follow me on twitter: https://twitter.com/myrocode
hmm... do I have any folks? Undecided

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Developer Life
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed

Insert into one table from another table SQL

Monday, 22 June 2009 18:00 by myro

Just a quick note to myself. I can never seem to find an example of this when I need it.
This insert statement copies records from TABLE_2 to TABLE_1 with some custom values

INSERT INTO TABLE_1 (Prd_ID, Sta_ID, StS_ID, TiP_ID, Prd_Titolo, Prd_Descrizione, Prd_ID_Catalogo, Prd_Notifica)
SELECT (SELECT max(Prd_ID) from INTO TABLE_1)+1, 1, 1, 17,  [INTO TABLE_2].Descrizione,  [INTO TABLE_2].Descrizione,  [INTO TABLE_2].Codice, 'N'
FROM [INTO TABLE_2]
WHERE  ([INTO TABLE_2].ID = 3)

hope this post can refresh your mind too...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   Developer Life
Actions:   Bookmark and Share | Permalink | Comments (1) | Comment RSSRSS comment feed

Mootools live demos and sourcecodes

Wednesday, 1 April 2009 11:51 by myro

If you are considering to use Mootools javascript framework, and you need to see it in action, visit

 http://demos111.mootools.net/

to obtain immediatly cool effects and the relative sourcodes.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Developer Life | Web
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed