Solved

Insert SQL Query upon receiving mail in mailbox

Posted on 2013-11-23
8
8,383 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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