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

  • Thread starter Thread starter Kukulkan
  • Start date Start date
Status
Not open for further replies.
K

Kukulkan

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
 
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.

"Kukulkan" <regify@googlemail.com> wrote in message

news:f696cb7f-dd1a-4a54-82af-eaee7473f39d@c16g2000yqd.googlegroups.com...
> 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
 
Re: 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
 
Re: 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
 
Re: 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
 
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.

"Kukulkan" <regify@googlemail.com> wrote in message

news:49cc75fb-baf1-4159-b8ce-f7b4c7599d3a@b30g2000yqd.googlegroups.com...
> 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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
I How to prevent exchange email account from sending emails in Outlook Using Outlook 4
C Prevent Outlook from sending an email with a blank Subject Line Outlook VBA and Custom Forms 3
P Prevent Outlook 2016 from using DASL filter Using Outlook 4
oj43085 Prevent Outlook from blocking image from a single source Using Outlook 4
D Prevent Outlook from resolving incomplete contact when clicking send Using Outlook 2
R How to prevent corrupted Notes format in Calendar and Contacts Using Outlook 0
O How to prevent image resize when pasting Using Outlook 2
D Prevent popup of "Do you want to save changes?" when closing after opening an appointment to view Outlook VBA and Custom Forms 2
O How to prevent CC from showing when creating a new mail? Using Outlook 1
A Prevent connection to Public Folders on Exchange? Exchange Server Administration 3
L OL 2016 contact: is there a way to prevent an admin from mistakenly deleting a contact? Using Outlook 1
D Multiple mailboxes, 1 certificate. How to prevent message "Invalid Certificate" Using Outlook 0
S How to prevent addins Using Outlook 0
makinmyway How Prevent Re-Formatting of Contact Notes Field When Syncing Using Outlook 10
Diane Poremsky Prevent Users From Choosing Stationery Using Outlook 0
evdbogaard How to prevent extra line feeds in replies Using Outlook 3
oliv- Prevent copying shared contacts Outlook VBA and Custom Forms 5
K Prevent meeting requests being sent from a shared calendar in a group mailbox Using Outlook 1
N Prevent reminder dismisal in shared calendar Using Outlook 1
C Security Question - How to prevent users exporting .iaf files Using Outlook 5
B Item_Write = False don't prevent custom form from closing Using Outlook 1
T WAB editing: To help prevent malicious code from running.......... Using Outlook 18
N Allow Another User to Send on Behalf of But Prevent Access to Inbox Using Outlook 4
R Exchange 2010 archive-prevent users moving items direct to archive Exchange Server Administration 1
M Links prevent sending email Using Outlook 3
K Prevent sending Excel files as attachements Outlook VBA and Custom Forms 1
G To Prevent Malicious Code from running, one or more objects in thi BCM (Business Contact Manager) 2
S To help prevent malicious code from running, one or more objects in this form were not loaded. For m Outlook VBA and Custom Forms 1
A Script to either modify "from" address or prevent a reply being se Outlook VBA and Custom Forms 2
J prevent user from installing wrong version of add-in Outlook VBA and Custom Forms 2
Z Prevent Changes to Custom Form Outlook VBA and Custom Forms 1
P newly installed Office 365 includes OLD Outlook Using Outlook 6
R Outlook ribbon menu default? Using Outlook 7
H Spam email in Gmail not visible in Outlook Using Outlook 3
J How to transfer Win 10 Outlook to new Windows 11 pc? Using Outlook 9
J Renegade spam URL line displayed in old local Outlook 365 email title Using Outlook 3
G Reduce whitespace in Outlook desktop Contact Cards display Using Outlook 3
C Outlook classic via 365 Using Outlook 2
Dr. Demento Analogous Outlook code to read info into an array (or collection or whatever) Outlook VBA and Custom Forms 7
S Repair Outlook Using Outlook 8
V Outlook Form ListBox is not editable Outlook VBA and Custom Forms 2
F Outlook's contacts Using Outlook 1
D Outlook 2003 stopped dead Using Outlook 2
G Cannot receive emails from gmail account in Outlook 365 Using Outlook 1
E "Cannot display the folder. MS Outlook cannot access the specified file location" Using Outlook 8
P Outlook 2016 Working Offline Using Outlook 2
Rupert Dragwater Cannot reestablish gmail (email address) account in Outlook 365 Using Outlook 11
O Outlook 365 synchronisieren Exchange Server Administration 1
kburrows Outlook Classic - JPG files are corrupted when opened or saved Using Outlook 3
F Sync Outlook Calendar Using Outlook 0

Similar threads

Back
Top