Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2007 - sending emails

Posted on 2011-02-20
5
Medium Priority
?
366 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 668 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 668 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 93

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 664 total points
ID: 34939152
0
 
LVL 93

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

715 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