email

  • Thread starter Thread starter Dorian C. Chalom
  • Start date Start date
D

Dorian C. Chalom

Can someone please point me in the right direction if I want to develop a
program to process incoming email? Is it even the right way to do it to
develop it in Access?
 
I wrote my own VB code that opens my Outlook inbox, and starts going through every email. It's pretty basic, but it might get you started.... (You may have to set some REFERENCES in your VB module to make this work.

Private Sub ReadInboxButton_Click(
' THIS READS YOUR OUTLOOK INBO
Dim myOlApp As Outlook.Applicatio
Dim myItem As Outlook.Folder
Dim myNameSpace As Outlook.NameSpac
Dim myFolder As Outlook.MAPIFolde
Dim EmailContent As Varian
Dim db As Databas
Set db = CurrentD
Dim InboxEmails, a, b As Intege
Dim CheckForError, ReadThisEmail As Strin

Set myOlApp = New Outlook.Application ' or use ---> CreateObject("Outlook.Application"

Set myNameSpace = myOlApp.GetNamespace("MAPI"
myNameSpace.Logon ' this line supposed to prevent Access from jumping to Outlook for authenticatio

Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox
InboxEmails = myFolder.Items.Coun
UpdateEmployeeTracking = vbN
For b = 1 To InboxEmail
CurrentEmplCounter.Value =

Set EmailContent = myFolder.Items.Item(b
On Error Resume Nex
CheckForError = EmailContent.SenderNam
If Err.Number = 438 The
' this error is only for "UPDATE" emails, which cannot be read by Acces
Err.Clea
On Error GoTo
Exit For ' skip this emai
End I
On Error GoTo
' -------------------------------------------------------------
ReadThisEmail = MsgBox("Email number " & b & " - " & EmailContent.Subject & " from " & EmailContent.SenderName & " (to: " & EmailContent.To & ", cc: " & EmailContent.CC & ", bcc: " & EmailContent.BCC & "). Open it?", vbYesNoCancel
If ReadThisEmail = vbYes The
MsgBox (EmailContent.Body) ' a simple display of the email tex
Els
If ReadThisEmail = vbCancel The
Exit Su
End I
End I
Next

End Su


----- Dorian C. Chalom wrote: ----

Can someone please point me in the right direction if I want to develop
program to process incoming email? Is it even the right way to do it t
develop it in Access
 
Thank you that will help alot...
TFerry said:
I wrote my own VB code that opens my Outlook inbox, and starts going
through every email. It's pretty basic, but it might get you started....
(You may have to set some REFERENCES in your VB module to make this work.)
Private Sub ReadInboxButton_Click()
' THIS READS YOUR OUTLOOK INBOX
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.Folders
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim EmailContent As Variant
Dim db As Database
Set db = CurrentDb
Dim InboxEmails, a, b As Integer
Dim CheckForError, ReadThisEmail As String

Set myOlApp = New Outlook.Application ' or use ---> CreateObject("Outlook.Application")

Set myNameSpace = myOlApp.GetNamespace("MAPI")
myNameSpace.Logon ' this line supposed to prevent Access from jumping to Outlook for authentication

Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
InboxEmails = myFolder.Items.Count
UpdateEmployeeTracking = vbNo
For b = 1 To InboxEmails
CurrentEmplCounter.Value = b

Set EmailContent = myFolder.Items.Item(b)
On Error Resume Next
CheckForError = EmailContent.SenderName
If Err.Number = 438 Then
' this error is only for "UPDATE" emails, which cannot be read by Access
Err.Clear
On Error GoTo 0
Exit For ' skip this email
End If
On Error GoTo 0
' -------------------------------------------------------------
ReadThisEmail = MsgBox("Email number " & b & " - " &
EmailContent.Subject & " from " & EmailContent.SenderName & " (to: " &
EmailContent.To & ", cc: " & EmailContent.CC & ", bcc: " & EmailContent.BCC
& "). Open it?", vbYesNoCancel)
 
Back
Top