Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-05-19
4
Medium Priority
?
436 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 46

Accepted Solution

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

Assisted Solution

by:rockiroads
rockiroads earned 1200 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 1200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

610 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