Solved

How do I generate emails from Access 2013

Posted on 2014-12-26
7
160 Views
Last Modified: 2015-01-29
Hi Experts,
I need help generating emails from my Access 2013 application.
I have a table with employee names and employee email addresses (tblEmployees).
I have a List box control that will list the email addresses.  I want to be able to select one or more email addresses from the list box, and then click a button to send a pre written email message.  How can I do this ?

Thank you very much in advance,
mrotor
0
Comment
Question by:mainrotor
[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
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40519258
here is the code to get selected emails from a multi select listbox

Dim j,strEmails
 With Me.listEmail
     If .ItemsSelected.Count > 0 Then
         For Each j In .ItemsSelected
           strEmails =strEmails & ";" & .ItemData(j)  'collect all selected items as strEmails
         Next
     End If
 End With
 strEmails= mid(strEmails, 2)
0
 
LVL 85
ID: 40519534
When you say "pre-written", do you mean the user has already written an email in their email client? Or that you want to have the user write the email in Access, and then select the recipients in your listbox and send that email?

Rey has shown you how to collect the selected items from the listbox, but to send the email you can either use SendObject, or use automation.

SendObject is used like this:

DoCmd.SendObject acSendNoObject, "", "", strEmails, "", "", "Email Subject", "Email Body"

 http://msdn.microsoft.com/en-us/library/office/ff197046%28v=office.15%29.aspx

There are some limitations to SendObject - for example, you can't send HTML emails, messages are limited to 255 characters, you can't attach files from disc, and the security mechanism in Outlook can cause troubles. If you need that additional functionality, you can automate Outlook. This article shows how to do that:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_4316-Automate-Outlook-in-VBA-with-the-OutlookCreateItem-Class.html
0
 

Author Comment

by:mainrotor
ID: 40521346
Thank you both for your help.  How about if the users use Yahoo, or G-mail for sending emails, could this be done?  

Is outlook the only way this could be done?

Thank you,
mrotor
0
 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40521668
You could, but not with Outlook Automation. Instead, you'd use CDO to do this. There are several questions here on EE that show how to do that, for example:

http://www.experts-exchange.com/Database/MS_Access/Q_21601489.html

You'd have to change the SMTP Server and Port to match those expected by the email server, of course.

There's also VBSendMail. As with CDO, there are many questions that address using vbSendMail, like this one:

http://www.experts-exchange.com/Database/MS_Access/Q_28093260.html
0
 

Author Comment

by:mainrotor
ID: 40528633
Thanks Scott,
I will checkout those links.

mrotor
0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 40577051
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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 …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

623 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