Solved

MS Access: Send Email Individually to Contacts From Outlook Email Template

Posted on 2009-05-19
4
423 Views
Last Modified: 2016-10-13
We have an MS Access Database with our contacts in it. We want the ability to send an email to a list of recipients using an outlook template from within Access.
0
Comment
Question by:VoodooFrog
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
tbsgadi earned 200 total points
ID: 24422267
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 300 total points
ID: 24422632
Here is sample code I have that creates a mail item from a template.

With regards to adding recipients, see the example on how you add them. In your scenario I would imagine creating a recordset to iterate thru all emails and adding them to the recipients list.

Now this uses outlook automation obviously but from A2003 you get the security message. You can get rid of this by installing click-yes (freebie software) or possibly use redemption, which works like outlook automation, I just dont know if it also creates from templates

If u wanted to override the default subject and message body, you can do this (after the createitem call)

    objEmailMessage.Subject = "Subject Goes Here"
    objEmailMessage.Body = "Body Here"

   

Public Sub SendOXPMail()
 

    Dim objOutlook As Object

    Dim objEmailMessage As Object

    

    

    On Error GoTo SendError

    

    'Create outlook objects

    Set objOutlook = CreateObject("Outlook.Application")

    

    'Specify template here

    Set objEmailMessage = objOutlook.CreateItemFromTemplate("C:\mytemplate.oft")

    

    'Set the addresses here

    objEmailMessage.Recipients.Add "fred@flintstone.com"

    objEmailMessage.Recipients.Add "wilma@flintstone.com"

    

    

    'TO DISPLAY OR SEND DELETE OR COMMENT APPROPRIATELY

    'Display email

    objEmailMessage.Display

    

    'Send it!

    'objEmailMessage.Send

    

SendError:

    If err.Number <> 0 Then MsgBox err.Description

    On Error Resume Next

    Set objEmailMessage = Nothing

    Set objOutlook = Nothing

End Sub

Open in new window

0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 300 total points
ID: 24422642
0
 

Expert Comment

by:ctupr
ID: 41842099
Do we have an updated answer for this question? I'm using Office 2013...
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now