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

Summary: Curious how to send an email from the access database? well many users like you ask this question frequently on various of the forum sites. therefore, today I have selected this specific topic to answer how to automatically send an email from access. if you are also looking for easy methods to send email from ms access database, please refer to this post.

how to automatically send an email from access 2016

Although there are various ways available to accomplish this task of sending email from access database but in this post, I am going to briefly discuss about the 3 easiest and most popular approaches.

  1. send email from access using outlook
  2. send email from access using sendobject method or emaildatabaseobject method
  3. send email from access via macro

so let’s get started…!

method 1: send an email from access using outlook

Send Email From Access Using Outlook

In this section, you will learn how to automatically send an ms outlook message in ms access. perspective you are currently using. therefore, get complete information about outlook email security update, from the following articles:

262631 ol2000: outlook email security update information

262617 ol98: Outlook Email Security Update Information

well, you can use the sendobject method to send the mapi mails programmatically in your ms access application. like, the sendobject method will not give you full access to the mail functionalities. as an option to set massage priority or to attach an external file.

The procedure mentioned below uses automation to create and send emails for access. you can take advantage of so many features in ms outlook that you won’t get in send object method.

There are mainly six steps to send email from access using outlook. these are the things you have done to your outlook mail.

  1. first of all, initialize the outlook session.
  2. create a new message.
  3. then add the recipients (cc, bcc and to) and assign their Names.
  4. set all valid properties, such as body, subject, and importance.
  5. add any attachments you want to attach.
  6. display or send the message.

steps to send email from access using outlook programmatically

  1. first you need to create a text file named customers.txt inside your c:my documents folder.
  2. now start your ms access application and open your sample database, for example: northwind.mdb.
See Also:  Cheapest Courier Shipping from USA to India: Parcel Monkey

It’s time to create a module in your access database. then write the “explicit option” line in the module declarations section only if it is not written there.

  1. from the tools menu, tap on the references option.
  2. now in the references box, tap to choose the > >microsoft outlook 9.0 object library then press ok option. then in that case look on your hard drive for the file “msoutl9.olb”, msoutl9.olb.

If you still can’t get that file, you need to run ms outlook setup to install it. after that, you can just proceed to the next procedure to send outlook email from access.

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

sub send message (optional attachment path) 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.app”)

‘ create the message. set objoutlookmsg = objoutlook.createitem(olmailitem)

with objoutlookmsg ‘add recipient(s) to the message. set objoutlookrecip = .recipients.add(“nancy davolio”) objoutlookrecip.type = olto

‘ add cc recipients 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 = oimportancehigh ‘high importance

‘ add attachments to the message. if (attachment path) is not missing, set objoutlookattach = .attachments.add(attachment path) end if

‘ resolve the name of each recipient. 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. To test this procedure, type the following line in the immediate window. then click the enter button from your keyboard:

send message “c:my documentscustomers.txt”

if you want to send an email from access without attaching any attachment, remove the arguments section while calling the procedure, like this:

send message

Useful article: how to import outlook email to access database?

Method 2: Send an email from the access using the sendobject method or the emaildatabaseobject method

Send Email From Access Using SendObject method or EMailDatabaseObject method

ms access offers you to send emails using the docmd.sendobject method in the vba module code. the well method works for sending simple emails, as it has some serious limitations.

See Also:  Gmail outlook sync is not working

Note: In the previous version of the access application, such as 2002/2003/2007, the sendobject method was used to send emails from the access. whereas, since the beginning of access 2010, this send object method was renamed to the email database object.

The user can use the emaildatabaseobject macro action in their respective access database application to attach a form, report, or access module to an email message. from where it can be easily viewed and then forwarded.

main target to use sendobject method

  • sendobject command allows you to send emails along with the option to attach reports, module data, tables, forms, queries, forms. well this attachment can be in any of these formats excel, text, html, pdf, rich text, xps, etc.
  • this send object specific command uses microsoft outlook or other email application which is based on mapi (mail application programming interface) to free your email. it will create a problem because windows security interrupts every mapi message and sends a confirmation prompt box.

sendobject method syntax

here is the syntax to use the sendobject method:

docmd.sendobject object type, object name, output format, to, cc, bcc, subject, message text, edit message, template file

macro syntax

Choose sendobject as the action and assign its arguments.

parameters

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

example of sending email from access using sendobject method

In the following example, I have included a table of employees within an email in ms excel format. then, you specified the necessary points of the mail message such as to, cc, and subject. the email will be sent immediately, without any editing.

docmd.sendobject acsendtable, “employees”, acformatxls, _ “nancy davolio; andrew fuller”, “joan weber”, , _ “current employee spreadsheet”, , false

limitations of using the sendobject method

although the sendobject command is very useful for sending a short message or object. but it still has so many significant limitations like:

  • messages must not be a maximum of 255 characters.
  • messages must be normal, plain text and cannot be in html format
  • you may Don’t attach multiple files.
  • you cannot filter the report or data source you need to send
  • there is no option to specify any source address.
  • mapi security dialog check each email message before sending.
  • except outlook, outlook express or exchange, the method will not work for other email application.
  • no there is option to specify settings like priority, confidentiality and read receipt
See Also:  Armie Hammer wanted to 'cut off a girlfriend's toe and keep it in his pocket' according to messages | Daily Mail Online

method 3: send email from access via macro

Send Email From Access Using Macro

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

  • open your ms access application.
  • open the database you want to use.
  • tap the “create” tab and then in the “macro” group.

SEND EMAIL FROM ACCESS USING MACRO 1

  • You will now see the actions catalog in the right corner of the login application window.
  • choose the “send object” option in the “action” dropdown box.

SEND EMAIL FROM ACCESS USING MACRO 2

  • you need to complete all the steps present in the action argument. for object type choose “report” and for object name (this is the name of the report you need to mail) choose “open issues”. for the output format, choose “pdf format (*.pdf)”.

You must now enter the report recipient’s email addresses, the email subject, and the email text.

if you need to edit the email message before sending it, choose the “yes” option; otherwise, choose the “no” option. to attach the html files, you need to assign the template path.

  • Tap the disk icon to save the macro.
  • Now it’s time to give your macro a name and then tap the “ok” option.
  • To run the macro, you must press the exclamation mark.
  • Press the “allow” option to tell the program to send emails. the report is sent via outlook.
  • to open the navigation pane, tap the double arrows.
  • to automatically access the report via email, double-click your macro saved.
  • li>

  • check whether the email has been sent or not by opening your mail.

summary:

All the above methods to send email automatically from access 2016/2013/2010/2007 are too easy to perform. now it’s up to you which method you want to try. so, try them first and share your opinion with us. good luck..!

Leave a Reply

Your email address will not be published. Required fields are marked *