"Mike MacSween" <mi***********************@btinternet.com> wrote in
news:40***********************@news.aaisp.net.uk:
like this:
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset(strSql)
rst.MoveFirst
Do While Not rst.EOF
Set oMailItem = oOutlook.CreateItem(olMailItem)
With oMailItem
.To = rst.Fields("Email1")
.Subject = "test from Access from Mike"
.Body = "don't worry, it's not a virus"
.Send
End With
Set oMailItem = Nothing
rst.MoveNext
Loop
Why set to Nothing when you're immediately going to set it to
something different at the top of the loop? You would then put a Set
to Nothing after the loop terminates.
What's your question?
Oh, I see.
The question is: do you *need* to recreate it or just change the
properties.
Set oMailItem = oOutlook.CreateItem(olMailItem)
Do While Not rst.EOF
With oMailItem
.To = rst.Fields("Email1")
.Subject = "test from Access from Mike"
.Body = "don't worry, it's not a virus"
.Send
End With
rst.MoveNext
Loop
Set oMailItem = Nothing
The answer to the question entirely depends on how Outlook deals
with the message. Does it get a different MessageID? I don't know
what interaction there is between Outlook and Exchange server in
those terms. I also don't know exactly where MessageIDs are
generated (I've always assumed at your local outbound SMTP server).
Of course, if you're generating the same email message to numerous
people, you could use CC or BCC to send a single message to multiple
recipients. Of course, that also may end up getting your email
classified as spam (which, to some people, it may be). Some ISPs
won't accept an email with more than 20 or 25 recipients, so you
might have to break them down in groups.
In any event, I don't know why there's be any reason to recreate the
object -- you could just re-use it. But you'd have to see if there
were any downsides to that.
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc