Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I have Exchange forward emails to SQL Server?

Posted on 2009-07-08
5
Medium Priority
?
407 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Check out the latest tech news, community articles, and expert highlights in August's newsletter.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This video discusses moving either the default database or any database to a new volume.

721 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