Speak SMTP Like a NativeIf you are writing an SMTP agent, you might find it instructive to learn to speak SMTP yourself, both to aid debugging and to get a feel for what is happening “under the hood” when Exchange receives a message from the internet. This is a lot easier than it might sound. Open the Run dialog box (press Windows Key + R) and enter “telnet localhost smtp” (or substitute the name of your Edge Transport server in place of localhost). This will open a window where you can talk with the server. The server will begin the conversation by sending a banner, such as: 220 mail.contoso.com ready at Thu, 23 Feb 2006 17:46:23 -0800
You may continue the conversation by entering the following commands, one line at a time. Note: There is a blank line in the middle – it’s important. Just press enter to send the blank line: ehlo console mail from: sender@contoso.com rcpt to: recipient@contoso.com data To: recipient@contoso.com From: sender@contoso.com Subject: Test Message This a test message. . quit | |
|---|
| |
The server will respond with a simple text message after the first three commands. After the “data” command, the server will just listen patiently until you enter the “.” on a line by itself. When you initially connect to the server, your agent will be created and the OnConnect event will be fired. Additional events are fired are follows: To: recipient@contoso.com From: sender@contoso.com Subject: Test Messageblank line) The blank line is important, it seperates the headers from the content of the message. When the blank line is received, OnEndOfHeaders fires.
You can also copy/paste the whole batch of commands, put them in a text file so you can replay an entire SMTP conversation quickly using only notepad and telnet. This can be really handy for testing. |