Log Email Queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database which logs various IT queries. I was wondering whether it
was possible to automate the database to Log Queries automatically from an
external mail source.

Thanks!!
 
Yes, it's possible using the Microsoft MAPI Control (MSMAPI32.OCX). Here's a
sample code snippet:

Dim objMail As MAPISession
Dim objMessage As MAPIMessages

Set objMail = New MAPISession
Set objMessage = New MAPIMessages

With objMail
.DownLoadMail = False
.LogonUI = True
.SignOn
If .SessionID = 0 Then
'Error
Exit Sub
End If
End With

With objMessage
.SessionID = objMail.SessionID
.FetchUnreadOnly = True
.Fetch
End With

For intLoop = 0 To objMessage.MsgCount - 1
'Process the message(s)
Next

With objMail
.SignOff
End With
 
Thanks for that Ron, it helps, however i am not too hot on the VB coding, and
if you could provide some notes as to what the code below does, that would be
great. Also i cannot see any bits of the code which relate to the external
mail source, or forms in which the information needs to be logged.

Thanks in advance!!!
 
You're not going to be able to do what you want without some coding. What
that code does is open a session to the default mail application (on the
machine it is run on) and loop through every message that is marked Unread.
As I said it is only a stub - you would have to write code to parse the
received message(s) and store the data in your table(s). Unfortunately that
is beyond the scope of a simple answer on Usenet. You might want to try
looking for more complete samples in these locations:

http://www.mvps.org/access
http://www.granite.ab.ca/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top