mainrotor
asked on
How do I generate emails from Access 2013
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
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
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:
https://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_4316-Automate-Outlook-in-VBA-with-the-OutlookCreateItem-Class.html
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:
https://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_4316-Automate-Outlook-in-VBA-with-the-OutlookCreateItem-Class.html
ASKER
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
Is outlook the only way this could be done?
Thank you,
mrotor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Scott,
I will checkout those links.
mrotor
I will checkout those links.
mrotor
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
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)