Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending out multiple messages from Drafts folder at once

383 views
Skip to first unread message

dmu

unread,
Nov 1, 2000, 5:38:25 PM11/1/00
to

We have VBA code in Access that creates a bunch (anywhere from 3 to 300) of
email messages and puts them in Outlook's draft folder. We put them first
in the drafts folder because it seems that if there are too many messages
beging created and sent at once, the system hangs (seems to get confused
between the message it's creating and the messages waiting to go out?) When
we are ready to send the messages out of the drafts folder, we have to
double click each message and click send. If we just drag the messages to
the outbox they sit there and don't go out. Is there an easier way to send
all of the messages out at once w/o having to go through each one?

Thanks.


Dmitry Streblechenko

unread,
Nov 1, 2000, 6:21:52 PM11/1/00
to

I had a related problem when automating Outlook from JavaScript. The problem is more fundamental than Outlook being confused: there
is a limit of 248 RPC (Remote Procedure Call) channels per process. Each item you create uses a separate RPC, once you go over that
limit, things go wild. Try to dispose of a mail item before creating a new one. An array of mail items would be an especially bad
idea.

Dmitry

"dmu" <a@a> wrote in message news:#NUHcRFRAHA.210@cppssbbsa03...

dmu

unread,
Nov 1, 2000, 7:40:11 PM11/1/00
to
Thanks for letting me know of the 248 limit. Creating and then saving each
message to drafts seemed to work better than creating and then sending each
message out directly. In access we use a SQL statement query that pulls
email addresses (stored in a table with other data) that we need to send
messages out to. The VBA loops through each record in the recordset and
creates the message, then does a .save instead of .send, and that seemed to
help. I'm guessing that the VBA closes each item as it puts it in drafts or
outbox? But when Outlook starts sending the items that opens them up again?
Only now we have to double click the 300 messages in outlook drafts and hit
send for each one.


"Dmitry Streblechenko" <dmi...@saleslogix.com> wrote in message
news:u0JPfpFRAHA.295@cppssbbsa03...

Dmitry Streblechenko

unread,
Nov 1, 2000, 8:27:17 PM11/1/00
to

Might be. I would try to send some limited number of messages (200), then periodically check the number of messages in the Outbox
folder using Outlook object model. Once it gets below some number (100) send another batch. Let me know if you can make it work.

Dmitry

"dmu" <a@a> wrote in message news:#LvAjVGRAHA.256@cppssbbsa03...

harry whodini

unread,
Nov 1, 2000, 8:57:25 PM11/1/00
to

Moment prease.

I asked a similar question (minus the Access bit) and R Bray was kind
enough to provide me with the following macro to send all from the
drafts folder.

I only understand about half the code, but it does work, for emails
and faxes.

Good luck with it.
--
Harry Whodini
Master criminologist and escapologist

Public Sub SendDrafts()

Dim lDraftItem As Long
Dim myOutlook As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolders As Outlook.Folders
Dim myDraftsFolder As Outlook.MAPIFolder

'Send all items in the "Drafts" folder that have a "To" address filled
in.

'Setup Outlook

Set myOutlook = Outlook.Application
Set myNameSpace = myOutlook.GetNamespace("MAPI")
Set myFolders = myNameSpace.Folders

'Set Draft Folder. This will need modification based on where it's
being run.

Set myDraftsFolder = myFolders("Personal Folders").Folders("Drafts")

'Loop through all Draft Items

For lDraftItem = myDraftsFolder.Items.Count To 1 Step -1

'Check for "To" address and only send if "To" is filled in.

If Len(Trim(myDraftsFolder.Items.Item(lDraftItem).To)) > 0 Then

'Send Item

myDraftsFolder.Items.Item(lDraftItem).Send

End If
Next lDraftItem

'Clean-up

Set myDraftsFolder = Nothing
Set myNameSpace = Nothing
Set myOutlook = Nothing

End Sub


dmu <a@a> wrote in message news:#NUHcRFRAHA.210@cppssbbsa03...
: We have VBA code in Access that creates a bunch (anywhere from 3 to

:
:


dmu

unread,
Nov 2, 2000, 1:37:17 PM11/2/00
to
Thanks so much! It's working in my test environment, and should be fine in
the real one.
-dmu

"harry whodini" <harry_...@yahoo.com> wrote in message
news:u1Aq7$GRAHA.235@cppssbbsa03...

Arunagiri Nathan Sornum

unread,
Aug 4, 2015, 11:18:06 PM8/4/15
to

hi i try to run this code but it has many errors. can someone help me
0 new messages