Import Exchange Mailbox into SQL

Posted on 2009-02-09
Last Modified: 2012-05-06
I would like to automatically check an Exchange mailbox and import the messages into a SQL 2000 Database.

What is the best way to do this? T-SQL? DTS?

If you have an example of a script to do this, that be excellent.

Thank you,
    LVL 41

    Accepted Solution

    Hello Carmelo_Iorianni_NWCCAC,

    You can do so by created a linked server to exchange as indicated below:

    Then you could schedule a job in SQL Agent to check your email on a regular basis by creating a step (type: Transact T-SQL) that runs your code indicated in the link above. More info on how to setup a job:

    Another possibility is to use SQL Mail and schedule a job again



    Author Comment

    Thank you,

    When using xp_readmail, is there any way to retrive the accual address in CC field? Currently when I import the CC it just shows the firendly name (example for, it just shows doe, jon)

    Thank you
    LVL 41

    Expert Comment

    Hmm, I don't think you can do so.
    Have you tried using the linked server?

    Author Comment

    Thank you,  
    From the links you provided, I was able to use xp_readmail to check a mailbox and import the messages into a MS SQL DB.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
    ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now