By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

SQL Server -- how do I retrieve mail?

P: n/a

So here's my dilemma. I need an automated SQL Server (2000) job that
runs once once per hour.

This jobs should:

1) Retrieve unread email for the user "Le" from our Exchange Server,
and insert it into a table.

2) Retrieve unread email for the user "Smith", from from our Exchange
Server, and insert it into a table.

3) Retrieve unread email for the user "Carrie", from from our Exchange
Server, and insert it into a table.

My initial thought is to create a DTS package to handle email
retrieval, and insert it into the table in the same step.

But I have no idea how to get started. How do I get DTS/SqlServer to
read mail for these three users?


Aug 17 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
If you're already using SQL Mail, then you could look at xp_readmail,
but it generally connects to a single mailbox which has been set up for
the MSSQL service account. You might be able to configure Exchange to
copy all emails to Smith etc to that mailbox, but I don't know much
about Exchange. See this KB article and the linked articles for more

As an alternative, you could write an external script in C#, Perl or
some other language, and call it from a scheduled task or a DTS
package. One final option would be to use a linked server to query
Exchange directly from MSSQL:


Aug 17 '05 #2

P: n/a
I haev looked into xp_readmail, and it works well, except that it
retrieves mail for SQLAGENT.

I have considered forwarding emails from those 3 users to SQLAGENT,
then parsing through those emails, but that is something I generally
would like to avoid if possible, since we use SQLAGENT for alot of
other things.


Aug 17 '05 #3

P: n/a
It's probably a general Exchange issue - how can one user (or client)
with one mailbox retrieve mail for several other users? Either the
client process has the security credentials of all the other users in
order to access their mailboxes directly, the other users somehow
delegate access to their mailboxes, or you copy mails to one single
mailbox. But you might get a better answer posting in an Exchange group
- there may already be a well-known solution for this situation.


Aug 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.