Sunday, April 17, 2011


Simple Mail Transfer Protocol (SMTP) is text based protocol for sending emails across the Internet. It grew for the need for different systems needing to communicate with each other.

A SMTP transactions consists of three command / reply sequences. They are:
  1. MAIL command. Establishes return address.
  2. RCPT command. Establishes recipient of message.
  3. DATA content of the message.
(Note: SMTP commands usually consist of four characters others are HELO and EHLO).

The Server responds to these commands uses status codes. The responses are positive (2xx reply codes) or negative. Negative replies can be permanent (5xx codes) or transient (4xx codes)

What is the difference between SMTP and POP and IMAP?

SMTP is really for sending messages. It cannot pull messages from a remote server on demand. You wanna read those messages sent to you that are on your email server. You need to use either the Post Office Protocol (POP) or Internet Message Access Protocol (IMAP).

So you wanna try it?

Ok, so you're sick of using email tools such as outlook for sending email messages. You wanna send your own messages?
  • Open a command prompt.
  • Type "telnet 25".
  • Talk to the server using SMTP.
SMTP and Web Services

It is possible to have Web Services over SMTP instead of HTTP. But it's more complex. Why? Because SMTP does not provide much flexibility to responses for requests. With HTTP a SOAP request message can be put into the HTTP message body. Similar a SOAP message can be put in the HTTP message body for a response. SMTP allows a SOAP message to be easily attached to the request. But not the response. A separate SMTP is required for the response.

So why why why would you ever want to use SMTP for sending SOAP messages? It might be:
  • You cannot use HTTP because of firewalls
  • The request / response model isn't desired by your application. You might just want something like publish / subscribe
  • You web services are take a long time to run and you don't want situations where HTTP will time out on you.


  1. RFC 821
  2. RFC 2821
  3. SMTP inside and out
  4. Web Services over SMTP
  5. WSDL 1.1 spec

No comments:

Post a Comment