3 Ways To Send Email From Access 2007/2010/2013/2016/2019

3 Easy Methods To Send Email From Access

SUMMARY: Curious to know how to send email from Access database? Well many users’ like you are frequently asking this question in several of the forum sites. So, today I have selected this specific topic to answer that how to automatically send email from Access. If you are also the one who is looking for some easy methods to send email from MS Access database then check out this post.

How To Automatically Send Email From Access 2016

Though there are several ways available to accomplish this send email from Access database task but in this post, I am going to briefly discuss about the 3 most easy and popular approaches.

  1. Send Email From Access Using Outlook
  2. Sending Email From Access Using SendObject method or EMailDatabaseObject method
  3. Send Email From Access Using Macro

So let’s  get started…!

Method 1: Send Email From Access Using Outlook

Send Email From Access Using Outlook

In this section you will learn how to automatically send MS Outlook message in MS Access.NOTE: The below mentioned code doesn’t work properly if you haven’t installed the right Outlook E-mail Security Update depending on the version of outlook you are currently been using. So, catch complete information about Outlook E-mail Security update, from the following articles:

262631 OL2000: Information About the Outlook E-mail Security Update

262617 OL98: Information About the Outlook E-mail Security Update

Well you can use the SendObject method for sending the MAPI mails programmatically in your MS Access application. As, the SendObject method won’t give you the complete access over the mail functionalities. Like option to set massage priority or to attach external file.

Below mentioned procedure uses Automation to create and send mail message to Access. You can take benefit of so many features in MS Outlook which you won’t get in the SendObject method.

Mainly there are six steps to send email from Access using Outlook. These are the things that you have perform in your outlook mail.

  1. First of all initialize the Outlook session.
  2. Make a new message.
  3. After then add the recipients (CC, BCC and To) and assign their names.
  4. Set all valid properties, like Body, Subject, and Importance.
  5. Add your attachments which you wants to attach.
  6. Show or send the message.

Steps To Send Email From Access Using Outlook Programmatically

  1. Firstly you need to make one text file with name Customers.txt right within your C:\My Documents folder.
  2. Now start your MS Access application and open your sample database eg: Northwind.mdb.

It’s time to create a module in your Access database. After then just type the line “Option Explicit” in the module Declarations section only if it’s not written there.

  1. From the Tools menu, tap to the References option.
  2. Now in the References box, tap to choose the Microsoft Outlook 9.0 Object Library Then hit the OK option.NOTE: sometime within the “Available References box”, you won’t get this “Microsoft Outlook 9.0 Object Library” option. Then in that case, make a browse in your hard disk for “Msoutl9.olb” file, Msoutl9.olb.

If still you are unable to fetch that file then you need to run MS Outlook Setup program for installing it. After then only you can proceed with the following procedure to send outlook email from Access.

  1. In the new module , you need to just type the following procedure:

Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

‘ Create the Outlook session.
Set objOutlook = CreateObject(“Outlook.Application”)

‘ Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
‘ Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(“Nancy Davolio”)
objOutlookRecip.Type = olTo

‘ Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(“Andrew Fuller”)
objOutlookRecip.Type = olCC

‘ Set the Subject, Body, and Importance of the message.
.Subject = “This is an Automation test with Microsoft Outlook”
.Body = “Last test – I promise.” & vbCrLf & vbCrLf
.Importance = olImportanceHigh  ‘High importance

‘ Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

‘ Resolve each Recipient’s name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send

End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

  1. For testing this procedure, type the following line in the immediate Window. After then make a press to the enter button from your keyboard:

SendMessage “C:\My Documents\Customers.txt”

If you want to send email from access without attaching any attachment then remove the argument section while calling procedure, like this:

SendMessage

HELPFUL ARTICLE: How To Import Outlook Email Into Access Database?

Method 2: Send Email From Access Using SendObject method or EMailDatabaseObject method

Send Email From Access Using SendObject method or EMailDatabaseObject method

MS Access offers you to send emails using DoCmd.SendObject method in VBA module code. Well method works to send simple emails as it has some significant limitations.

Note: in the former version of Access application like 2002/2003/2007 SendObject method was used for sending email from access. Whereas, from the beginning of Access 2010 this SendObject method was renamed to EMailDatabaseObject.

User can use the EMailDatabaseObject macro action in their respective Access databases application to attach Access form, report, or module in e-mail message. From where it can be easily viewed and then forwarded.

Main Objective To Use SendObject Method

  • The SendObject command allows you to email message along with the option to attach report, module data, table, form, query, form. Well this attachment can be in any of these formats Excel, text, HTML, PDF, rich text, XPS etc.
  • This specific SendObject command make use of Microsoft Outlook or other email application which is based on MAPI (Mail Applications Programming Interface) to release your email. It will create issue because Windows security interrupts each MAPI message and sends confirmation prompt box.

Syntax of the SendObject Method

Here is the syntax to use the SendObject Method:

DoCmd.SendObject ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile

Macro Syntax

Choose SendObject like action and assign its arguments.

Parameters

Each parameter has some meaning and all the above mentioned parameters in the syntax are optional.

Example of Sending Email From Access Using SendObject method

In the below example I have included an Employees table within a mail in MS Excel format. After then specified the mail message necessary points like To, Cc, and Subject. The email will be immediately sent, without doing any editing.

DoCmd.SendObject acSendTable, “Employees”, acFormatXLS, _  “Nancy Davolio; Andrew Fuller”, “Joan Weber”, , _  “Current Spreadsheet of Employees”, , False 

Limitations Of Using SendObject method

Though SendObject command is very useful to send short message or an object. But still it has so many significant limitations such as:

  • Messages must not be maximum than 255 characters.
  • Messages must be a normal, plain text and it can’t be in the HTML format
  • You can’t attach multiple files.
  • You can’t filter the report or data source which you need to send
  • No option to specify any FROM address.
  • MAPI security dialog box verify each email message before sending it.
  • Except Outlook, Outlook Express, or Exchange the method won’t work for other email app.
  • No option to specify settings like priority, sensitivity, and read receipt

Method 3:  Send Email From Access Using Macro

Send Email From Access Using Macro

In the third and last method we will learn to send mail through access macro.

  • Open your MS Access application.
  • Open the database which you want to use.
  • Tap to the “Create” tab and then on the “Macro” group.

SEND EMAIL FROM ACCESS USING MACRO 1

  • Now you will see action catalog on the right-hand side corner of the Access application Window.
  • Choose the “Send Object” option from the drop-down box of “Action”.

SEND EMAIL FROM ACCESS USING MACRO 2

  • You need to complete every steps present within Action Argument. For Object Type, choose “Report” and for object name (it is the report name that need to mail) choose “Open Issues”. For the output format choose the “PDF Format (*.pdf)”.

Now you have to enter the report recipient’s email addresses, email subject and the email text.

If you need to edit the email message before sending it then choose the “Yes” option otherwise choose the “No” option. For attaching the HTML files, you need to assign the path of template.

  • Tap to the disk icon for saving up the Macro.
  • Now it’s time to give name to your macro and then tap to the “OK” option.
  • To run the macro you need to hit the exclamation point.
  • Hit on the “Allow” option to order the program for sending email. The report is sent through Outlook.
  • For opening up the Navigation Pane tap to the double arrows.
  • To automatically email Access report make a double-click on your saved macro.
  • Make a check whether the email has been sent or not by opening up your mail.

Wrap up:

All the aforementioned methods to automatically send email from Access 2016/2013/2010/2007 are too easy to perform.  It’s up to you now that which method you want to try. So, try them first and share your opinion with us. Good luck..!

tip Still having issues? Fix them with Stellar Repair for Access:

This software ensures seamless repair & recovery of ACCDB & MDB database and restores all objects including tables, reports, queries, records, forms, and indexes along with modules, macros, etc. Fix Microsoft Access issues now in 3 easy steps:

  1. Download Stellar Access Database Repair Tool rated Great on Cnet.
  2. Click Browse and Search option to locate corrupt Access database.
  3. Click Repair button to repair & preview the database objects.

Avatar

Pearson Willey is a website content writer and long-form content planner. Besides this, he is also an avid reader. Thus he knows very well how to write an engaging content for readers. Writing is like a growing edge for him. He loves exploring his knowledge on MS Access & sharing tech blogs.