Solved

Access 2007 - sending emails

Posted on 2011-02-20
5
365 Views
Last Modified: 2012-05-11
My OS is windows 7 and I have a small database with email addresses.  I want to automate the process of sending a message from Access or using mail merge from MS word.  Is there any sample apps or template that I can follow.  I propose to use Outlook as my email client.  Thank u.
0
Comment
Question by:jegajothy
[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
5 Comments
 
LVL 15

Accepted Solution

by:
gplana earned 167 total points
ID: 34938923
Please try this:
Option Compare Database
Option Explicit


Public Function SendMail(DisplayMsg As Boolean, strTo As String, strCC As
String, strBCC As String, _
strSubject As String, strBody As String, strAttachPathFile As String) As
Boolean

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

Set objOutlook = CreateObject("Outlook Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)


With objOutlookMsg

'Add "To" recipient
Set objOutlookRecip = .Recipients.Add(strTo)
objOutlookRecip.Type = olTo

'"Add "CC" recipient
If IsNull(strCC) = False Then
Set objOutlookRecip = .Recipients.Add(strCC)
objOutlookRecip.Type = olCC
End If

'Add "BCC" recipient
If IsNull(strBCC) = False Then
Set objOutlookRecip = .Recipients.Add(strBCC)
objOutlookRecip.Type = olBCC
End If

'Add subject, body, and importance of the E-Mail Messzage
.Subject = strSubject
.Body = strBody
.Importance = olImportanceHigh


'Add Attachment
If IsNull(strAttachPathFile) = False Then
Set objOutlookAttach = .Attachments.Add(strAttachPathFile)
End If

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next objOutlookRecip

.Send
End With

Set objOutlookMsg = Nothing
Set objOutlook = Nothing


End Function

Open in new window

0
 
LVL 19

Assisted Solution

by:Richard Daneke
Richard Daneke earned 167 total points
ID: 34938985
You can use Word 2007 or Publisher 2007  to send customized emails to a list of recipients that may (or may not ) be in your Contacts list.  Outlook is the program that sends the emails.

In this case, you use Access to maintain the list of intended recipients.   Update Access tables with names, email addresses and other data fields for the email.

For Word or Publisher, create a file and use Mailings tab to start send emails.  The recipient list can use an Access table, an Access query, or Outlook Contacts to send email.

The VBA code example is great for sending email from within an Access database.  
0
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 166 total points
ID: 34939152
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 34966603
jegajothy,

Glad to help!  If you have not already done so, I would really appreciate it if you could please return to my article
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_4316-Automate-Outlook-in-VBA-with-the-OutlookCreateItem-Class.html
and click 'Yes' for the 'Was this helpful?' voting.

Patrick
0
 

Author Comment

by:jegajothy
ID: 34966794
Patrick,
I saw your article, since my present project is a volunteer one, thus I would not want to spend too much time on it.  But it is good to know that it is doable especially when we have Gurus like u.
0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

631 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