Quantcast
Channel: All OutlookCode.com content
Viewing all articles
Browse latest Browse all 871

Timing The sending of EMAILS

$
0
0
I have written some code to break up an e-mail I receive into parts, then forward those parts as separate e-mails to a text message address (ie, cell phone number). I want to make "sure" the parts are sent in order, even though possibly I cannot control the sms service to send them in the order received. So my intent is to cause outlook to create and send the individual messages, and sit in the outbox for several seconds before being sent. I have tried this numerous ways and someone posted some code to toggle the send/receive control, but it doesn't seem to help. Here is the loop which creates and sends the parts, can someone tell me a way to make outlook pause so they don't all get sent in a blast. For iLoop = 1 To UBound(Arr) If Arr(iLoop) <> "" Then Set NewMessage = Application.CreateItem(olMailItem) NewMessage.To = strDestination NewMessage.Subject = "" NewMessage.Body = Arr(iLoop) ScheduledSendReceiveToggle 'should toggle to disable NewMessage.Send oApp.ActiveExplorer.CommandBars("Standard").Controls("Send/Re&ceive").Execute timernow = Timer Do While Timer - timernow < 5 'pause 5 seconds Loop ScheduledSendReceiveToggle 'should toggle to enable but how to force send / receive? End If Next Sub ScheduledSendReceiveToggle() Dim ctl As Office.CommandBarControl Set ctl = ActiveExplorer.CommandBars.FindControl(, 6867) If ctl.Enabled Then ctl.Execute End If End Sub

Viewing all articles
Browse latest Browse all 871

Trending Articles