none
Still using xp_readmail, but doesnt work with Exchange 2016 RRS feed

  • Question

  • Hi All-

     Ive inherited an older system that uses a custom stored procedure to read email from an inbox (using SQLMail - NOT database mail) then insert the contents of the email into a table.  This is on a SQL 2008 R2 system and we were using exchange 2010 up until today.

    The team has been migrating from Exchange 2010 to Exchange 2016. As soon as the mailbox that we use SQL and xp_readmail to process mail from is migrated to the Exchange 2016 we run into issues.  The SP still runs, however it doesnt read the body of the email.  This works fine when the mailbox is on Exchange 2010.  Knowing that SQLMail uses a local Outlook Profile, this is a bit perplexing to me as Im thinking the version of exchange shouldn't matter.  Outlook versions did not change.

    Now, I know, I know... SQLMail is no longer supported and hasnt been for a very long time and we need to move to other software/tech for this but we are in a pinch and not able to move away from SQLMail at the moment. This is the only mailbox preventing us from decommissioning the Exchange 2010 server and people want that server gone.

    Can anyone help me get some insight into why xp_readmail would read the body of the mail (@message) when the mailbox is on Exchange 2010, but not when its on Exchange 2016?  The rest of the fields seem to function correctly.  Ive been able to reproduce this on a test system that Im using to troubleshoot.

    Thanks much!


    Saturday, March 18, 2017 2:55 AM

All replies

  • A guess is that the API for Exchange has changed. Maybe Exchange 2016 has dropped support for something old and dusty and xp_readmail was using. A question in an Exchange forum may give you further information.

    I note that on my SQL Server instances, I have xp_readmail on SQL 2008, but not SQL 2012.

    Seems like you have gotten the kick in butt you need to move away from SQLmail.

    Saturday, March 18, 2017 1:37 PM
  • Im hesitant to accept the API has been removed, though I do some some items in the "whats been discontinued from exchange 2016" article.

    https://technet.microsoft.com/en-us/library/jj619283%28v=exchg.160%29.aspx?f=255&MSPPError=-2147217396

    Though I cant fine information on how SQLMail fully operates.  The function "works" but just doesnt pull in the message of the mail.

    Yeah this may be the kick we need to get off sqlmail, but Im hoping to remove the exchange 2010 server on Monday. Until we get a workaround, this server needs to stay.

    Any other options or items to try?

    Saturday, March 18, 2017 4:39 PM
  • I see that the MAPI library has been removed. That rings a bell in the context of SQL Mail.

    Saturday, March 18, 2017 4:56 PM
  • Agreed. I think that may be the key here,but youd think that when running xp_readmail itd just error out then, but it doesnt. It reads all the other info except for the body of the message.

    Saturday, March 18, 2017 6:54 PM
  • Yeah, apparently it drops the error on the floor. Or, well, Books Online says Any failure except an invalid parameter is logged to the Microsoft Windows Application Log. Did you look there?

    Saturday, March 18, 2017 7:40 PM
  • Yeah just did. Nothing more in there that items such as these:

    Attempting to load library 'sqlmap.dll' into memory. This is an informational message only. No user action is required.

    Using 'sqlmap.dll' version '2009.100.1600' to execute extended stored procedure 'xp_readmail'. This is an informational message only; no user action is required.

    Error: 1073759806 Severity: 1 State: 0 Starting SQL Mail session...

    Error: 1073759778 Severity: 1 State: 0 SQL Mail session started.

    Saturday, March 18, 2017 8:51 PM
  • Hi pseudoyams,

    This forum is about T-SQL programming, since your issue is related to Exchange, we would help you move this thread to the Exchange Server Development forum for better support. If you have any issues about T-SQL programming, you’re welcome to post them here.

    Thank you for your understanding and support.

    Best Regards,

    Albert Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 20, 2017 7:18 AM
  • OK, thanks. I was unsure where to place this one. I thought maybe this would be the correct place since it relates to sql queries.

    Ill post it over in the exchange forum.

    Thanks.

    Monday, March 20, 2017 12:40 PM