A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to prevent that Outlook is sending before my add-in is finished?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 10th 10, 11:40 AM posted to microsoft.public.outlook.program_addins
Kukulkan[_2_]
external usenet poster
 
Posts: 9
Default How to prevent that Outlook is sending before my add-in is finished?

Hi,

I made an Outlook AddIn (OL2003 and OL2007) by using VB6 and
Redemption Objects. I need to manipulate the message before sending
(change Body, remove and add attachments). In most cases this works
fine, but in some rare cases there seem to occur problems. It looks
like OL is sending the message before my add-in is finished. This is
mainly observed on OL that is connected to an Exchange server.

In my code I need to call Mailitem.Save a few times. For example,
after removing attachments and before adding a new one (without this,
adding attachments will fail). I suppose that OL uses exactly this
moment to send the message. This results in messages that do not
contain the attachment that I like to add later.

Is there a way to prevent sending messages for a while? I want to be
shure that the message will get only sent after I finished my job? Any
idea?

Thanks,

Kukulkan
Ads
  #2  
Old March 10th 10, 03:20 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to prevent that Outlook is sending before my add-in is finished?

What event are you using? I've never had any sends go out without my
allowing it when I've handled either the Send() event for an item or the
Application.ItemSend() event. It doesn't matter if Exchange is involved, the
first thing that will happen after an item is sent is the firing of the
Send() event for that item.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Kukulkan" wrote in message
...
Hi,

I made an Outlook AddIn (OL2003 and OL2007) by using VB6 and
Redemption Objects. I need to manipulate the message before sending
(change Body, remove and add attachments). In most cases this works
fine, but in some rare cases there seem to occur problems. It looks
like OL is sending the message before my add-in is finished. This is
mainly observed on OL that is connected to an Exchange server.

In my code I need to call Mailitem.Save a few times. For example,
after removing attachments and before adding a new one (without this,
adding attachments will fail). I suppose that OL uses exactly this
moment to send the message. This results in messages that do not
contain the attachment that I like to add later.

Is there a way to prevent sending messages for a while? I want to be
shure that the message will get only sent after I finished my job? Any
idea?

Thanks,

Kukulkan


  #3  
Old March 12th 10, 11:20 AM posted to microsoft.public.outlook.program_addins
Kukulkan[_2_]
external usenet poster
 
Posts: 9
Default How to prevent that Outlook is sending before my add-in isfinished?

Hi Ken,

What event are you using? I've never had any sends go out without my
allowing it when I've handled either the Send() event for an item or the
Application.ItemSend() event. It doesn't matter if Exchange is involved, the
first thing that will happen after an item is sent is the firing of the
Send() event for that item.


I capture the send-event of the mailitem. Inside, I call my function
to reconvert the e-mail before sending. I think, the mailitem is
already marked for delivery in this moment. And outlook does not wait
until the Sent() event returns and try's to send in the meanwhile
(possibly in the moment I call Item.save).

While processing, I call an external compression utility using Shell()
command. To wait for the end of this tool, I use
OpenProcess(PROCESS_QUERY_INFORMATION + SYNCHRONIZE, 0, TaskID) and
GetExitCodeProcess() in a loop with many DoEvents calls. May this be
part of the problem?

I wrapped the send-item event to capture it. The Cancel-Property is
wrapped, too. Only some customers are affected. On others it runs
perfectly. Is there a way to prevent outlook from sending/receiving
while I'm processing the mail?

Regards,

Kukulkan
  #4  
Old March 16th 10, 02:13 PM posted to microsoft.public.outlook.program_addins
Kukulkan[_2_]
external usenet poster
 
Posts: 9
Default How to prevent that Outlook is sending before my add-in isfinished?

Hi Ken,

Thank you for your help.

My guess is that your code is hitting an unexpected error in those cases
where you have problems and is aborting your event handler or bypassing
parts of it.


I used the debugger to step through all parts. Every involved routine
has an on error goto statement with an error-dialog. The complete
problem is, that I sometimes having different weird behaviours in
exchange environment (only by my customers, but never here):

Sometimes, the e-mail gets received multiple times by the recipients.
They are all identical. In my routines, I manipulate one(!) e-mail,
and in rare cases the recipient receives up to 5 copies (sometimes
only 3 or 2. That changes random). I do not change any recipients in
the e-mail. In the sent-items folder of the sender, there is only one
item! In my inbox, there are sometimes three absolute identical mails.

Sometimes, the e-mail comes without attachment. I definitely add an
attachment to the mail! In the sent-items folder of the sender, the e-
mail has the attachment. In my inbox, there is no attachment.

Something really strage is going on here...

I will try to find out more. Maybe one of my customers is willing to
let me do some debugging...

Kukulkan
  #5  
Old March 16th 10, 02:51 PM posted to microsoft.public.outlook.program_addins
Kukulkan[_2_]
external usenet poster
 
Posts: 9
Default How to prevent that Outlook is sending before my add-in isfinished?

I have additional information:

I checked the behaviour with one of my customers. This is what we
found:

An e-mail, TO: Recipient1 CC: Recipient2 should be processed.
- processing occured with no error-message (changed Body and
Attachments)
- Recipient1 received the e-mail two times incl. attachment
- Recipient2 received the e-mail without attachment (one times)
- in sent-items folder of the sender, the e-mail is found one times
without(!) attachment

This is strange. The same mail arrived two times at Recipient1 -
including the attachment!
In sent-items folder, the attachment is missing!

Any idea? On most customers, no problems occur. Maybe a problem with
CC:? Is there something to take care about? Any idea?

Thank you,

Kukulkan
  #6  
Old March 16th 10, 05:54 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to prevent that Outlook is sending before my add-in is finished?

This is only a guess, and you need to find what's different about systems
where the problem occurs and where it doesn't, but my guess is an anti-virus
addin that scans outgoing and incoming emails. That's almost always a bad
idea and can cause problems like the ones you're seeing. Multiple sends,
sometimes hundreds of them, items lost in space or a black hole and various
other problems are all common when incoming/outgoing emails are scanned. See
if that's the possible cause of the problem.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Kukulkan" wrote in message
...
I have additional information:

I checked the behaviour with one of my customers. This is what we
found:

An e-mail, TO: Recipient1 CC: Recipient2 should be processed.
- processing occured with no error-message (changed Body and
Attachments)
- Recipient1 received the e-mail two times incl. attachment
- Recipient2 received the e-mail without attachment (one times)
- in sent-items folder of the sender, the e-mail is found one times
without(!) attachment

This is strange. The same mail arrived two times at Recipient1 -
including the attachment!
In sent-items folder, the attachment is missing!

Any idea? On most customers, no problems occur. Maybe a problem with
CC:? Is there something to take care about? Any idea?

Thank you,

Kukulkan


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent Outlook from sending an email with a blank Subject Line Collector Dave Outlook and VBA 3 November 8th 09 02:24 PM
Possible to prevent sending an email without a category? [email protected] Outlook - General Queries 5 July 27th 07 12:19 PM
Getting outlook to not show finished tasks Shane C. Outlook - General Queries 1 June 4th 07 09:10 PM
how do you do you prevent outlook from sending copies Crisra13 Outlook - General Queries 1 November 17th 06 04:34 PM
why does outlook freeze untill it is finished looking for mail in need of answers Outlook - Using Forms 0 October 6th 06 02:47 AM


All times are GMT +1. The time now is 01:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.