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

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
 
K

Ken Slovak - [MVP - Outlook]

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
 
K

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
 
K

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
 
K

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
 
K

Ken Slovak - [MVP - Outlook]

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.
Thread starter Similar threads 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
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
D Images showing up as X's in Outlook 2003 emails. Outlook is set to HTML and Prevent Picture downloa Using Outlook 2
G Prevent my AT&amp;T email from being imported into Outlook 2003 when I open outlook. Using Outlook 1
G How do I prevent the Outlook 2010 Reminder window from staying on top of other windows after clickin Using Outlook 5
R Do Outlook Connector on Outlook 2007 and iTunes conflict to prevent syncing contacts to an iPhone? Using Outlook 3
C Prevent clients outlook anywhere URL from being changed by autodiscover? Using Outlook 4
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 New Slipstick.com Articles 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
S How to Prevent of using CC field Using Outlook 1
D Received emails show only red X's no images - Email set for HTML. Prevent download of images is OFF Using Outlook 6
V Prevent appointments not yet accepted from showing up in Calendars Using Outlook 3
B Prevent changing of appointment time or date by other users Using Outlook 1
B how do you prevent email adressess from popping when sending a new email Using Outlook 1
J When I try to click on a link embedded in an email I get an error that says that computer restrictions prevent access. Call the system administrator Using Outlook 1
E Prevent Looping Message using transport rule Exchange Server Administration 4
G Prevent Changes in text of Original e-mail Using Outlook 1
A Prevent "forwarding" with the meeting invite Using Outlook 1
M How can I prevent calendar items from appearing conversation threads in my Inbox? Using Outlook 3
U Prevent mailbox owner delegating access Exchange Server Administration 2
T Prevent Task Accepted and task update messages from deleting in Task OL2007 inbox. (I received a task update message in my Inbox, but it disappeared.) Using Outlook 7
L Prevent Users From Creating Private Appointments on Shared Calendars Using Outlook 3
T Prevent Task Accepted and task update messages from deleting in Task OL2007 inbox. (I received a ta Using Outlook 5
B Prevent Duplicates When Importing iCalendar files. Using Outlook 1
N Is there a way to prevent email being sent from IP addresses other than your own or from friends receiving emails with your email address that have di Using Outlook 1
G some emails when deleted from the inbox start to reappear later upto 30 times per day. How do I prevent it? Using Outlook 2
M Random font enlargement on sent and received emails. How do you prevent this from happening? Using Outlook 1
S Prevent Cross-Forest New-MoveRequest from deleting the source mailbox Exchange Server Administration 10
L Prevent Exchange from becoming default account on Windows 7 Using Outlook 5
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
Similar threads


















































Top