Solved

Insert SQL Query upon receiving mail in mailbox

Posted on 2013-11-23
8
7,872 Views
Last Modified: 2016-02-11
Team - may be a dumb question / difficult one.

I have a mailbox. Lets say "CorporateMailbox". What I need is, Whenever any user sends an email with the subject line "123456 1x1 completed for 987654", I need to auto-write an sql query to a table which will say, Insert into 1on1table (Submitternt, Submitterid, type, status, Employeeid) values ("Senders' mail id without "@abc.com", "123456", "1x1", "completed", "987654")

Can someone guide me on these lines please?

intent is to have the query done for multiple activities/ type like 1x1, Performance improvement plan etc., but the insert query have to happen live. that is, if i send an email to the mailbox with correct subject line, query should run immediately, else, an auto email should trigger to the sender with correct subject line format.

Please help
0
Comment
Question by:Manju
8 Comments
 
LVL 6

Author Comment

by:Manju
ID: 39671616
btw, i found this article. http://msdn.microsoft.com/en-us/magazine/cc301799.aspx

Will this suffice? do i need to be an admin or something? where can i store n run the macro?
0
 
LVL 28

Assisted Solution

by:Ryan McCauley
Ryan McCauley earned 250 total points
ID: 39672244
I've done macros in Outlook before and you don't need to be a local administrator to implement them - you're just restricted to activities your user can normally do. In this case, as long as your Windows user can perform those database inserts (or you have the SQL login for a user that can), you can write a VBA macro in Outlook to do whatever you want when you receive a message. In my case,

The walk-through you linked is a great starting point - it's pretty thorough and covers everything you'd need to know to set this up. If you have specific questions about the implementation, feel free to post them and the community can help, but you're definitely on the right track.
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 39672296
Mmm... you can create a POP3 client and check the inbox each 30 seconds and discard the emails already processed.

Its a quite simple to create a POP3 client, just:
1. USER
2. PASS
3. LIST
4. RETR
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 250 total points
ID: 39672342
It is a good article, and is on the right path.

You can also use SQL Server, there are routines to get mail, process mail etc... http://technet.microsoft.com/en-us/library/ms179879(v=sql.105).aspx

But those are deprecated in sql2012, and have to use DBmail instead.

Then, you could always do what I did (and I am handy with SQL and can write macros) and use a third part tool such as : http://www.geniusconnect.com/ (which is the one I have used) or http://www.email2db.com/ (which has also been recommended but a lot more expensive).

For the $100 geniusconnect business version (for me) it did everything I needed and was not all that different to your requirement.

So, three choices for you...

1) From Outlook push to SQL (ie the Article)
2) From SQL Server pull from Outlook (fair bit of set up, but good examples around)
3) Third Party tool (probably the easiest, but costs)
0
 
LVL 6

Author Closing Comment

by:Manju
ID: 39673143
Thanks Ryan & Mark
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
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
This video discusses moving either the default database or any database to a new volume.

743 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

12 Experts available now in Live!

Get 1:1 Help Now