Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to force Outlook to send items from Outbox 2

Status
Not open for further replies.

markros

Programmer
May 21, 2007
3,150
0
0
US
Hi,

We have an application that sends appointments through MS Outlook using redemption to suppress the security warnings.

Unfortunately, we seem to have a problem of items sitting in Outbox and not sent right away.

We tried this code
Code:
loFolder = loNameSpace.GetDefaultfolder(4) && Go to Outbox, folder 4
*This was the first try - didn't work and even introduced a *security warning message back
* loSend = loFolder.Items(1).Send && Send waiting items

* Tried this - no security message, but no effect either
loNameSpace.SyncObjects.Item(1).Start()

This was the original code (I added a check for TotalItems - it was creating ~700 or more tasks in Outlook and eventually bringing the system down)

Code:
*!*				ltSendStartTime=DATETIME()
*!*				lnTotalItems = 0
*!*				DO WHILE loFolder.Items.Count>0 AND DATETIME()-ltSendStartTime<10
*!*					* Force delivery
*!*					FOR lnIndex=1 TO loNameSpace.SyncObjects.Count
*!*						loNameSpace.SyncObjects.Item(lnIndex).Start()
*!*						IF lnTotalItems > 100
*!*						   EXIT
*!*						ENDIF
*!*						   
*!*						lnTotalItems = lnTotalItems + 1
*!*					ENDFOR
*!*					IF lnTotalItems > 100
*!*						   EXIT
*!*					ENDIF
*!*				ENDDO
*!*				
*!*				=MESSAGEBOX("Number of items we're sending " + TRANSFORM(lnTotalItems))

So, do you know if there is an elegant way to force items out right away?

Thanks.
 
I'm pretty sure that's controlled by the user's Outlook settings and you can't automate it.

Tamar
 
As TamarGranor has already said, this is a user-controlled Outlook setting. Without some sort of hack like the aforementioned sendnow, you probably aren't going to get around it.

You can use Extended MAPI to get around the security message using the VFPExMAPI.fll from my blog... VFP Extended MAPI. No need for Redemption unless there is something else you are looking for Redemption to allow you to do that can't be handled with the free FLL.

As for the sending emails right away... have you perhaps considered simply formatting and sending the email yourself through an available SMTP server? BLAT can certainly handle this...
Email and VFP: Part 1h (BLAT)

And so can CDOSYS...
Email and VFP: Part 1c (CDOSYS)

In any event, good luck. If you find a workable solution for getting Outlook to Send immediately without that security warning popping up let us know. I think it's a waste of your time... but you may prove me wrong.

boyd.gif

SweetPotato Software Website
My Blog
 
I have not tried the SendNow approach mentioned above, but in order to ensure that all of the 100's of automatically generated emails that we send each morning go out, we just ensure that Outlook is Open and running (done through automated ShellExecute - Open).

If Outlook is merely running as some background task or not appearing to run at all, then the emails created through Redemption are often 'stalled' in the Draft folder. These 'stalled' emails most often eventually go out, but when is somewhat uncertain.

But as long as Outlook is truly Open and running, then the emails go to the Draft folder and then are automatically Send from there in response to the .SEND command.

Good Luck,
JRB-Bldr


 
I implemented this code

Sync = loNameSpace.SyncObjects.ITEM(1)
Sync.START()

It seems to work, though it starts sending items in about 2-3 sec. - so may be it's default Outlook setting, after all.

I just adjusted the original code, that was already using Redemption. I keep in mind your fll for the future, thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top