Continuously monitors Outlook and stores email data in database (1 Viewer)

cursedeye

Registered User.
Local time
Today, 03:21
Joined
Oct 7, 2009
Messages
50
Is there a way for access to continuously monitor Outlook (sending/
receiving) and store email data in database?
 

ajetrumpet

Banned
Local time
Today, 01:21
Joined
Jun 22, 2007
Messages
5,638
yes there is. set a timer to run every so often, open up an instance of outlook using getobject() or createobject() and loop through the emails in the inbox, check the unread() property, and if it's true, extract the "from" property and throw it in a table.
 

Mike375

Registered User.
Local time
Today, 16:21
Joined
Aug 28, 2008
Messages
2,548
The following code is in an Excel macro. Access opens the Excel file (but it is not visibe) and then runs the Excel macro. This brings the email details into Excel. Access then imports the Excel file to a table. I did it this way because I found it easier. It is getting the email details from an Outlook folder called Bounces

Code:
Dim myOlApp As Outlook.Application
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myfolders = myNameSpace.Folders
n = 1
Do Until myfolders.Item(n) = "Personal Folders"
n = n + 1
Loop
Set myfolder = myfolders.Item(n)
Set myfolder2 = myfolder.Folders("Bounces")
c = 1
n = 1
For Each Item In myfolder2.Items
itsj = Item.Subject

itsn = Item.To
itbo = Item.SenderEmailAddress
itbz = Item.CreationTime
itbx = Item.Body
Cells(n, c) = itsn
Cells(n, c + 1) = itsj
Cells(n, c + 2) = itbo
Cells(n, c + 3) = itbz
Cells(n, c + 4) = itbx

n = n + 1
Next Item
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:21
Joined
Aug 30, 2003
Messages
36,140
You may also be able to use an Outlook rule to fire off a process from that end. I'm not good with Outlook to Access code, so I wrote an exe that processed certain received emails and imported attached Excel files to Access (SQL Server actually). That exe was triggered by a rule. I would guess that someone more versed in Outlook code could do it all from Outlook.
 

Users who are viewing this thread

Top Bottom