Recipe7.26.Testing SMTP Manually


Recipe 7.26. Testing SMTP Manually

Problem

You need to manually test your Exchange server's SMTP functionality by injecting a test message.

Solution

Using the Windows telnet client:

  1. Open a connection to port 25 of your Exchange server:

    telnet  <server name or IP address>  25

  2. At the banner, enter the EHLO command and verify that you receive a 250 response code:

    220 <server FQDN>  Microsoft ESMTP MAIL Service, Version: 6.0.3790.211 ready at <time and date>  EHLO   <client FQDN> 250-<server FQDN>  Hello [<client IP address> ] <list of ESMTP capabilities>  250 OK

  3. Use the MAIL FROM command to identify the envelope sender. Verify that Exchange accepts the sender with a 250 result code:

    MAIL FROM:   <sender address> 250 2.1.0 <sender address> ....Sender OK

  4. Use the RCPT TO command to identify the envelope recipient. Verify that Exchange accepts the recipient with a 250 result code. If you want to send to multiple recipients, repeat this step once for every recipient:

    RCPT TO:   <recipient address> 250 2.1.5 <recipient address> 

  5. Use the DATA command to enter the message body. Although the headers are not strictly required, they can be useful. If the From: and To: headers are not present in the message, Exchange will substitute the envelope values given in the previous steps. Verify that Exchange is ready to accept the message body with a 354 result code:

    DATA 354 Start mail input; end with <CRLF>.<CRLF> From:  <sender address> To:  <recipient address> Subject: Testing This is a manual SMTP test message.

  6. End body entry by typing a single period on a line by itself. Verify that Exchange accepts the message with a 250 result code:

    . 250 2.6.0 <MessageID> Queued mail for delivery

  7. Use the QUIT command to close the connection:

    QUIT 221 2.0.0 <server FQDN> Service closing transmission channel

  8. Use a client such as Outlook or OWA to verify the delivery of the message.

Discussion

Knowing how to manually inject SMTP test messages is a valuable troubleshooting skill that can save you a lot of time and energy. Often, you need to send a quick message through a particular server or to test a specific mailbox. It is easy to script the creation of messages using CDO (although CDO is outside the scope of this book), but you may not always have your script with you.

The SMTP conversation recorded in this recipe is the simplest one that involves actual transmission of a message, yet it allows you to validate the following information:

  • The SMTP service is running and accepting connections.

  • The server is correctly identifying itself.

  • The server is accepting ESMTP functionality (if not, EHLO would be rejected and you would need to use HELO instead).

  • Sender filtering is working as planned (using an envelope sender address that should be blocked should result in a rejection of the MAIL FROM command).

  • Recipient lookups (e.g., the DSAccess routines) and recipient filters are working.

  • Message routing is working.

If you have the ability to test from a special IP address you set aside, you can even test the connection filtering if you need to. If your client IP address is in the filter, you should be denied connection.

If you make a typo during an SMTP command or email address and correct it using the backspace key, you will probably need to re-enter the command. When entering email addresses manually, be sure always to wrap them in angle brackets:

Wrong: MAIL FROM: deving@3sharp.com
Right: MAIL FROM: <deving@3sharp.com>

The brackets tell the SMTP address parser code that it is dealing with a raw address, which is a type of quoting specified in the RFCs. It tells the parser that this is to be treated just as an email address and reduces the likelihood of parsing errors. Raw addresses will also transit from SMTP to X.400 without translation or expansion if they are routed through your system.

When entering the message body, you should use at least the following headers, although they are not required:

  • From:

  • To:

  • Subject:

Exchange will automatically create other appropriate headers.

See Also

RFC 2821 (Simple Mail Transfer Protocol) for a description of SMTP and RFC 2822 (Internet Message Format) for a description of the Internet message format



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net