sending emails to multiple recipients via MS access/outlook (1 Viewer)

talha

New member
Local time
Today, 16:36
Joined
May 9, 2020
Messages
3
Hi,

I am new bee to Access and want to send emails to a multiple recipients through MS Access/Outlook. here are my requirements

  • Recipient addresses are stored in a table (about 1000 of them)
  • Message and subject will be the same for all the emails
  • want to send one recipient per email
  • want to attach word file to all the emails
  • Want to send single email after every 5 minutes until all recipients receive it
  • I want to suppress any pop-up
  • my outlook currently have 2 accounts set up. want to use one of them


Thanks in advance for assistance
 

talha

New member
Local time
Today, 16:36
Joined
May 9, 2020
Messages
3
sorry, I should be clear. as I am new, would like to get a reference to step by step tutorial. any suggestions
 

arnelgp

error reading drive A:
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
11,198
email 1000 for every 5 min
= 5000 min or 83 hrs
= 3.5 days to complete sending your emails.
 

talha

New member
Local time
Today, 16:36
Joined
May 9, 2020
Messages
3
cool, I am able to send basic email with the code below.

Here is what I am having challenges with:

1) email is not adding attachments
2) rather than sending emails to fixed addresses, I want to send it to recipients saved in the table "Emails_to_send"

can you please assist





Option Compare Database

Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("To@email.com")
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("CC@email.com")
objOutlookRecip.Type = olCC

' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "Last test - I promise." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send

End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
 

isladogs

CID VIP
Local time
Today, 22:36
Joined
Jan 14, 2017
Messages
14,271
If all recipients are to receive exactly the same email and attachment, why not blind copy (bcc) all of them to a single email.
This will speed things up significantly.

Also it is possible to send emails direct from Access without using Outlook. In fact it doesn't even need to be installed.
This approach uses a method called Collaborative Data Objects (CDO).
To use it, you need to get the settings for your email account from e.g. Outlook or Windows Mail.
If you would like to try this, see my CDO Email Tester example app.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:36
Joined
Sep 21, 2011
Messages
7,511

arnelgp

error reading drive A:
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
11,198
is related to crossposting, but not related here.
see New member? Readme first.
to those who have seen similar post by the op on diff forum, refrain yourself from Helping the op.
its a sin for you to xpost, but not to x answer.
 

isladogs

CID VIP
Local time
Today, 22:36
Joined
Jan 14, 2017
Messages
14,271
Not at all sure what @arnelgp means by his comments in the last post.

@talha
To be absolutely clear, there's nothing inherently wrong with cross posting provided the poster states they have done so and provides the link
 

arnelgp

error reading drive A:
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
11,198
you are always concern about Crossposting.
if you have responded on Other site on same op, then
let other's in This site answer and Keep Your Silence.
you are Limiting the resources of new ops.
and I've seen many get hurt and turned away from
this forum and never again seen.

If I am researching and I used a book of an author, then
read another of his book, what is that? cross-reading?

a new member is always refered to the forum "New member?, Readme first"
it should be clear on the first place what is crossposting and is it allowed here.
and i don't think Anybody, Specifically instructed you to block anybody to cross post.
neither Anybody solicit your service to this forum.

you are always to referring to Excel site about the rule on crosspost.
is that forum the Mother forum of all forum, and by nature should adapt
whatever the Rules on that forum?

in some of you living in the US, a rule on one state is not necessarily mean
the rule of the other.
 

isladogs

CID VIP
Local time
Today, 22:36
Joined
Jan 14, 2017
Messages
14,271
@arnelgp
It seems that you have completely misunderstood the point regarding crossposting.
Anyone is free to ask a question in more than one forum.
However they are asked to provide details as a courtesy to other members and prevent people wasting time answering questions that have already been answered elsewhere.
As for 'cross-reading', what on earth does reading several books by the same author have to do with anything?

BTW it would also be courteous to give the source of your code when you take it from one of your books
 

arnelgp

error reading drive A:
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
11,198
the op maybe not satisfied with the answers that is why they
are seeking other forums.

it's a waste of time, because you get involved in one forum but
the ops even choose to hop on another forum, unsatisfied by
the answers he get.

I have many books but I kept the code in my mind and heart so
I cannot recall from which one I get the Idea.

also if the code is from One of your programmers, you should also
mention them.

I know how software house works, I am a product of one when I was younger.
 

isladogs

CID VIP
Local time
Today, 22:36
Joined
Jan 14, 2017
Messages
14,271
@arnelgp
If you look at my free or commercial apps you will see I acknowledge all code and ideas used that came from a named source.
As for mentioning 'one of my programmers', I am a sole trader so there's nobody other than me. 😁
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:36
Joined
Aug 30, 2003
Messages
34,830
The point is not that you "can't" or "shouldn't" cross post, it's that you should disclose that you did it. The Excel site is referenced often because it says all that in a polite way. If you bothered to read it.
 

arnelgp

error reading drive A:
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
11,198
should disclose that you did it
please, without redirection, point me on this forum.

on that forum:
Ask yourself this: How would you feel if you worked on an answer for an hour, only to find out that fifteen minutes after you started, someone already had a solution they accepted? I'd be willing to bet you'd be a little upset that you'd wasted your time.
not really, I am a willing contributor!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:36
Joined
Aug 30, 2003
Messages
34,830
How about this from that site:

First, let me make it clear that neither I, nor the person who pointed you here, has an issue with cross posting, so long as it is done correctly....What we are asking for, however, is the courtesy of knowing about it.
 

arnelgp

error reading drive A:
Local time
Tomorrow, 06:36
Joined
May 7, 2009
Messages
11,198
then you do it, in respect for that site.
 

Users who are viewing this thread

Top Bottom