Solved

How do I have Exchange forward emails to SQL Server?

Posted on 2009-07-08
5
376 Views
Last Modified: 2013-11-30
I would like to have emails that are sent to a specific email address, e.g. help@mycompany.com, to be imported into SQL Server via a stored procedure.

I did some research and it appears that I either script for every single message on Exchange, or I create a database job that uses xp_mail to retrieve the mail.

Any ideas and code?
0
Comment
Question by:Unionblitz
  • 2
  • 2
5 Comments
 
LVL 30

Expert Comment

by:Britt Thompson
ID: 24809402
It's very easy to have Exchange forward emails to a specific email address...is this all the email going to exchange or just a single email address that needs to be forwarded to the SQL server?

If it's all the mail to the server you can enable Journaling and forward all the mail from the journal user to the SQL server email : http://technet.microsoft.com/en-us/library/bb124786(EXCHG.65).aspx

To forward email from Exchange 2003 right click on the User in AD > properties > Exchange General tab > Delivery Options > forward to > select the Contact email address to forward to

To forward email from Exchange 2007 right click on the User in Exchange Management Console > properties > Mail Flow Settings tab > Delivery Options > Properties > forward to > select the Contact email address to forward to

If you're needing to pull the mail from the SQL server the Journaling option in Exchange may still play a part...it's pretty heavy on the server depending on the kind of email traffic it has though. If forwarding it from the journal mailbox I wouldn't keep a copy on the server...the mailbox will get unmanageably large.
0
 

Author Comment

by:Unionblitz
ID: 24810340
Actually, what I want:

1. someone sends an email to help@mycompany.com.
2. SQL Server should some be able to read the new email for help@mycompany.com.
3. SQL Server runs a stored procedure to insert that email into the database.

The only way I can figure this out at the moment is to create an executable in C# that uses Outlook to access the email profile/items, then run a Windows Job against that executable every 10-15 minutes.  This seems grossly inefficient though.

Thoughts?
0
 
LVL 10

Expert Comment

by:dnilson
ID: 24810626
TRy

email2DB
http://www.email2db.com/?source=adwords

AN POP
http://216.240.159.81/titles/parse-email.htm

SQL built in command xp_readmail - a tutorail
http://www.informit.com/guides/content.aspx?g=sqlserver&seqNum=31

Addin Express emulates outlook to SQL interfaces
http://www.add-in-express.com/



0
 
LVL 30

Accepted Solution

by:
Britt Thompson earned 500 total points
ID: 24812218
You shouldn't need to use Outlook since you can take the mail directly from the Exchange server while still allowing people to read the mail from Outlook.

Event Sinks: @http://www.eggheadcafe.com/forumarchives/Exchange2000development/Sep2005/post23590076.asp
"you might want to look at using Event sinks. An Event sink can be setup to fire when a new mail arrives and you can then use ADO/Exoledb to access that data and ship it off to your SQL server."

Exchange SDK: http://msdn.microsoft.com/exchange 
http://gsexdev.blogspot.com/2005/07/shared-mailbox-database-public-folder.html

Other than the Exchange part of this it's beyond my scope...try the recommendations from dnilson.
0
 

Author Closing Comment

by:Unionblitz
ID: 31601074
Thank you all for your comments.  This one appears to be the most economical, and it hit the issue right on the head.  Going through Event Sinks appears to be a direct way to stream the emails into the database.  Now I need to figure out how to set up an event sink and write some code for it to execute.  The solution did provide some code, so I might not even need to do that much.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data‚Ķ
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates‚Ķ

792 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