Microsoft Access Email FAQ - Outlook

Last updated 09/27/2010

With the CDO reference library available with Outlook 98 and newer, you can send emails through Automation from any Access 97 database. Visit the Access Web site for a class module which automates this for you.

If you are dealing with multiple versions of Outlook, or the possibility that Outlook might not be installed on the client system then you want to use Late Binding.

Sample code is also available from Slipstick Systems, CDOLive and searching at MSDN.  Also see Connecting Outlook and Exchange to Databases 

See How to Send E-Mail From MS Access using Outlook for a very nice tutorial on how to use Outlook including looping through a query to send individualized emails.

"A program is trying to automatically send e-mail on your behalf."
"A program is trying to access e-mail address you have stored in Outlook."

Getting the above messages from Outlook?  This is caused by the Outlook Security Patch.  See Slipstick's Outlook Email Security Update for details.

If you have Exchange Server and Outlook 2002, you can turn the Security messages don/off with the Outlook Security Features Administrative Package:
OL2002: Administrator Information About E-Mail Security Features - 290499
Outlook Security Features Administrative Package
Customizing the Outlook Security Features Administrative Package

You can also program round the Security messages using the Redemption library.

Express ClickYes is a tiny program that sits in the System Tray and clicks the Yes button on behalf of you, when Outlook's Security Guard opens prompt

Outlook "Object Model Guard" Security Issues for Developers

If you are using Windows NT or Windows 2000 as an OS then you can use CDONTS. It uses the SMTP Service to send mail directly. However the SMTP service must be running on the machine and the machine must have internet access.  You add a reference to Microsoft CDO for NTS 1.2 Library in Access.:

Dim oEMail As New CDONTS.EMail

oEMail.From "anyname@anydomain.com"
oEMail.To "youremail@yourdomain.com"
oEMail.BodyFormat = CdoBodyFormatText
oEMail.Body = "Insert some useful text here"
oEMail.Importance = CdoHigh
oEMail.AttachFile "C:\filename.txt"
oEMail.Send

[ Email | Access Tips | Access | Main ]

Auto FE Updater   Auto FE Updater distribute new and updated Front End databases to your users with several mouse clicks.

Wrench and gear Granite Fleet Manager - the best designed fleet maintenance tracking and management system available

Comments email Tony  Search Contact Tony's Blog Privacy Policy Table of Contents

Website copyright 1995-2013 Tony Toews