Solved

How do I have Exchange forward emails to SQL Server?

Posted on 2009-07-08
5
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
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.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

729 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