Access to send E-mail reminders in Outlook (1 Viewer)

Harry_38

Registered User
Joined
Jan 14, 2011
Messages
41
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?
 

Ranman256

Registered User
Joined
Apr 9, 2015
Messages
3,435
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"
 

Cronk

Registered User
Joined
Jul 4, 2013
Messages
2,235
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.
 

Minty

AWF VIP
Joined
Jul 26, 2013
Messages
6,544
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 = "[email protected]"
        .SentOnBehalfOfName = "[email protected]"
        .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.
 

Harry_38

Registered User
Joined
Jan 14, 2011
Messages
41
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

Registered User
Joined
Jan 14, 2011
Messages
41
Minty, I tried the link to Ron and it worked. Thanks a lot and I will thank Ron as well.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom