Link to home
Start Free TrialLog in
Avatar of Chet Powell
Chet PowellFlag for United States of America

asked on

Outlook vba to send draft emails

Is there and way to use vba to send x amount (say 50) emails from the drafts folder, at an x time interval?

I found this here, but....

Sub sendDrafts()

Dim intmai As integer

    with Application.Session.GetDefaultFolder(olFolderDrafts)

        For intmai = .Items.count to 1 step -1

        .Items(intmai).Send

        Next

    end with

End Sub
Avatar of [ fanpages ]
[ fanpages ]

...but what?

What have you tried to implement the time interval requirement?

PS. You have not closed a previously asked (& abandoned) question:

[ https://www.experts-exchange.com/questions/28964895/Excel-for-Mac-VBA.html ]
Avatar of Chet Powell

ASKER

I really don't know where to start to try. I asked because I don't know if it can even be done.

Chet
How or when does the process of sending start?

Is it a manual request actioned by, say, clicking a button, or does it occur automatically from a fixed time on a particular day/date (or even occur every day, or every second Tuesday in a month)?

Does the sending begin when the Drafts folder has reached a total of fifty items?

Where is the interval between sends set, or dictated?
And.. I think the x amount of emaiotd lies in the items.count line, but not sure what to change it to.
And.. I think the x amount of emaiotd lies in the items.count line, but not sure what to change it to.

Sorry, what is "emaiotd"?
Starting isn't major issue. Clickin a button would b fine. If i could get it to say, at a particular time.. if it's the se as in Excel, I can get thay. What I want is. Once it starts  it goes though, from the first, send 50 emails, then stops. Then say an hour later, does it again . I just don't want it to send all at once, in a short amount of time. It locks up the computer.

Byw.. thanks for helping.
Emails.. darned autocorrect...
Also wondering if the wait method would work for the interval  but I want it to happen after sending a group of 50
So you want a VBA you can start, which then sends 50 mails stored in Drafts, then pauses, then sends the next 50.
The issue is that if you do that with a single, simple VBA, you block Outlook until finished. We can improve that a bit by allowing processing of Outlook's internal tasks while "pausing", but that doesn't work well over an extended period.

However: Outlook has a great feature allowing delayed sending at an individual set up date and time. Since it doesn't seem to be an issue for you to have Outlook running while the send should happen, which is required for delayed send, I suggest we write VBA code to go thru drafts and set that feature time either with continues delay (say 5 seconds for each mail), or in a bulk as originally asked for.
SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Objection: The only complete solution is mine at https:#a41792655.
https:#a41792618 would work with major changes - it shows a concept, but does not solve the majority of the question as-is. It deserves some points for the idea.