Home  Fees/Services  Access 2010 Template  Access Tutorial  Access Download  Articles  Search  Contact  Privacy  Links

Read Outlook Email From Access
How To Read Email From Microsoft Access






Visual Basic Tutorials:
Access-Google Earth
Age Calculation
Change To Proper Case
Email via Gmail #1
Send Gmail Email #2
Inactivity Logout Code
Outlook Email
Read Email Access
Email Attachment
Send Outlook Email
Running Sum
Denormalize Records
Stock Quotes
CreateQueryDef
Find Database Path
Detail-Master Update
Data Field Validation
Field Value New-Old
FindFirst
Access Version
Global Variable Parameter
Global Variables
Active Labels
Files List Box
Mail Merge
Quick Sort
Recordset Filters
Reference Form Field
Select Case
Access Transactions


Visual Basic Function Examples



Read Email into Microsoft Access Database

Reading email with Visual Basic API and create your own spam filter?  You can by reading Outlook emails from Microsoft Access. There are three VB code samples demonstrating methods to communicate between Microsoft Access database and Microsoft Outlook for the purpose of sending and receiving emails programmatically using VBA:



Are you just starting out on your quest for a small business database? Need some advice or someone to bounce ideas off of? We are happy to chat with you to discuss options to your situation.

Are you looking for an MS Access template database? We have many for sale in our Access Template and Examples Software section.


MS Outlook provides a Visual Basic MAPI API to read email from Access VB and process attachments too.  In the example below we connect to the Microsoft Outlook inbox via the API and loop through each email message while storing parts of the email into a table:

Private Sub ReadInbox
Dim TempRst As DAO.Recordset
Dim rst As DAO.Recordset
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim InboxItems As Outlook.Items
Dim Mailobject As Object
Dim db As DAO.Database
Dim dealer As Integer
DoCmd.RunSQL "Delete * from tbl_outlooktemp"
Set db = CurrentDb

Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set TempRst = CurrentDb.OpenRecordset("tbl_OutlookTemp")
'
Set InboxItems = Inbox.Items
'
For Each Mailobject In InboxItems
    If Mailobject.UnRead Then
    With TempRst
       
        .AddNew
        !Subject = Mailobject.Subject
        !from = Mailobject.SenderName
        !To = Mailobject.To
        !Body = Mailobject.Body
        !DateSent = Mailobject.SentOn
        .Update
        Mailobject.UnRead = False

    End With
End If
Next

Set OlApp = Nothing
Set Inbox = Nothing
Set InboxItems = Nothing
Set Mailobject = Nothing
Set TempRst = Nothing

End Sub


To create your own spam filter you can use several techniques.  Some examples are

  • Connect to the Outlook address book and check incoming addresses against your email address entries

  • Create a table of exclusion words for emails and use the Instr() function to scan for excluded words

  • Create a table of inclusion words to grab read email with these words.

To learn how to send Outlook emails using Microsoft Access.










Blue Claw Database Design Downloadable Tutorial:
Choose Command Dynamic SQL Order By  








A Blue Claw Software Design Template:

Document Revision Control Application
 










A Blue Claw Database Design Article:

How To Create Faster Access Databases
 

Microsoft Office:
MS Access 2000 Through 2016 and Office 365 & Sharepoint


Contact Information

Copyright 2000-2017 Blue Claw Database Design

Microsoft Access 2007, 2010, 2013 & 2016