Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-28-2016, 12:06 AM   #1
Harry_38
Newly Registered User
 
Join Date: Jan 2011
Location: Netherlands
Posts: 41
Thanks: 4
Thanked 0 Times in 0 Posts
Harry_38 is on a distinguished road
Access to send E-mail reminders in Outlook

I managed to write a script to initiate e-mails from Access2010 and send to Outlook. Access places the e-mails in the Outbox of the default e-mail account.
How can I make Access place the e-mails in the Outbox of a chosen e-mail account?

Harry_38 is offline   Reply With Quote
Old 01-28-2016, 01:15 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,400
Thanks: 0
Thanked 753 Times in 736 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Access to send E-mail reminders in Outlook

In a form,have a list box of emails.
Select the one you want. Select a report.(another list/combo box)
Click a send button. the code is:

Docmd.sendobject acSendReport, lstRpt, acFormatPDF, lstEmail, ,,"subject line", "body msg"
Ranman256 is offline   Reply With Quote
Old 01-28-2016, 01:17 AM   #3
Cronk
Newly Registered User
 
Join Date: Jul 2013
Posts: 2,203
Thanks: 3
Thanked 475 Times in 468 Posts
Cronk will become famous soon enough Cronk will become famous soon enough
Re: Access to send E-mail reminders in Outlook

You need to have your code such that you are connected to the account you want to use.

Post your code and the account name you want to use.

In my (limited) experience, emails generated in the Outbox are not automatically sent. You also need to have code to loop through messages and send them individually.

Cronk is offline   Reply With Quote
Old 01-28-2016, 01:31 AM   #4
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,488
Thanks: 174
Thanked 1,752 Times in 1,720 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
Re: Access to send E-mail reminders in Outlook

If you are using Outlook automation you can specify an .SentOnBehalfOfName and use .send to send immediately instead of displaying it

Code:
With OutMail
        .To = Variable_To
        .CC = ""
        .BCC = ""
        .Subject = Variable_Subject
        .MailItem.ReplyRecipients.Add = "someone@somewhere.com"
        .SentOnBehalfOfName = "someoneelse@somewhere.com"
        .Attachments.Add (Variable_AttachmentFile)
        .HTMLBody = Variable_Body & signature
        .Display        'or use .Send to send immediately 
        .ReadReceiptRequested = False
Be aware if the person who's account this is being sent from doesn't have permissions on the account in SentOnBehalfOfName then this will fail.

There are a million other mail properties you can access using the Automation object.
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is online now   Reply With Quote
Old 01-28-2016, 06:28 AM   #5
Harry_38
Newly Registered User
 
Join Date: Jan 2011
Location: Netherlands
Posts: 41
Thanks: 4
Thanked 0 Times in 0 Posts
Harry_38 is on a distinguished road
Re: Access to send E-mail reminders in Outlook

I need to explain a bit more.
My question concerns an Access administration application for a society with members. Some 80 members haven't paid their contribution yet.
- I've made a query that selects the 80 members;
- I got a tblLettres, that stores the text of the e-mail to be sent;
- Using VBA (Do Until rs EOF/ Move Next Loop) I select all the data and record by record it produces 80 e-mails in Outbox of the default E-mailAccount.
- My default email account is the one I use privately
Back to my question: I need some VBA lines that will palce my 80 emails not in the Outbox of my default emailAccount but in the Outbox of emailAccount of the Society.

Ranman, thanks for your reply; is the above clear?
Cronk, thanks; the code is lengthy, some 120 lines. I will try to shorten it by deleting lines that are not needed to explain the problem and post it later to-day
Minty Thanks. I am aware I could use 'SentOn BehalfOfName'. But the e-mails still finish up in the Outbox I don't want.

Hope you can help me.
Harry_38 is offline   Reply With Quote
Old 01-28-2016, 06:48 AM   #6
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,488
Thanks: 174
Thanked 1,752 Times in 1,720 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
Re: Access to send E-mail reminders in Outlook

Understood - Have a look here ;
http://www.rondebruin.nl/win/s1/outlook/account.htm

Hopefully this explains what you need.
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is online now   Reply With Quote
The Following User Says Thank You to Minty For This Useful Post:
Harry_38 (01-28-2016)
Old 01-28-2016, 07:35 AM   #7
Harry_38
Newly Registered User
 
Join Date: Jan 2011
Location: Netherlands
Posts: 41
Thanks: 4
Thanked 0 Times in 0 Posts
Harry_38 is on a distinguished road
Re: Access to send E-mail reminders in Outlook

Minty, I tried the link to Ron and it worked. Thanks a lot and I will thank Ron as well.


Harry_38 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to Outlook Calendar for Alert Message Reminders Sippy Modules & VBA 0 09-10-2013 12:17 PM
Send mail through MS Outlook in Citrix moulikjads Modules & VBA 1 04-15-2013 09:04 AM
Access send e-mail using Outlook tylerbrown Forms 10 03-15-2013 07:48 AM
Send Mail via VBA outlook 2010 SteveE Modules & VBA 0 12-18-2012 05:29 AM
Question How do I use VBA to send an Outlook mail info@pinetreeit.com General 2 05-26-2012 11:36 PM




All times are GMT -8. The time now is 05:44 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World