BUG: SQLMail: sp_processmail Returns Failure Code But No Error

Last reviewed: May 2, 1997
Article ID: Q147165

The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG# NT: 13306 (6.00)

SYMPTOMS

The sp_processmail procedure will return a value of 1 to indicate failure, however, it does not return any error messages to indicate the cause of the failure. Under some circumstances, sp_processmail may fail to run successfully even though SQLMail is properly set up and there is one or more messages in the inbox to be processed.

CAUSE

If the originator of a mail message in SQL Server's inbox is a mail username that cannot be resolved to a valid mail address, sp_processmail will fail.

WORKAROUND

You can do one of the following to work around this problem:

  1. Maintain a table in SQL Server containing mail usernames and their corresponding mail addresses. Rewrite sp_processmail to look up the user's address and supply that when calling xp_sendmail.

  2. Have users include their mail address on the subject line of the message. Rewrite sp_processmail to supply that address when calling xp_sendmail.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

You can tell if the mail username can be successfully resolved to a mail address by running xp_sendmail to send a message to that user. If the username cannot be successfully resolved to a mail address, xp_sendmail will return the following error:

   Msg 17921, Level 18, State 1
   A recipient was specified ambiguously

For example, if there is a mail username of "SQL" and another of "SQL Server," the following command will correctly result in Msg 17921:

   EXEC xp_sendmail "SQL", "Test message"

This is correct behavior because MAPI is unable to resolve the name "SQL" because it could potentially be resolved to either of the accounts from above. If a user logs in to mail as "SQL" and sends a message to SQL Server, sp_processmail will fail because it attempts to do an xp_sendmail to send a message to "SQL." The correct behavior for sp_processmail would be to use the mail address of the original sender when running xp_sendmail.

The mail address would be of the form [MS:network/postoffice/mailbox], such as the following:

   EXEC xp_sendmail "[MS:Windows/scotthu/sql]", "Test message"


Additional query words: sql6
Keywords : kbbug6.00 kbprg SSrvStProc
Version : 6.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.