Skip to main content

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Make sure you have an exception procedure setup in your declarative section. I think in our program when this occurs, an exception is raised by Outlook, but we handle it in the exception procedure so that it won't crash.

If you want to avoid the Outlook warning, we've used an ActiveX control that will disable the security briefly and then re-enable it.

http://www.add-in-express.com/outlook-security/

Rob

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Thanks,

There are no screens or anything in this program, as its just a purchase order print program, which decides that it needs to email the order if appropriate.

So where would I place the exception procedure, and what should it actually do?

Thanks very much,
Shaun

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Shaun,

I guess I should've clarified... You may need one for an ActiveX interface. Are you communicating to Outlook via ActiveX?

Rob

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Shaun,

I guess I should've clarified... You may need one for an ActiveX interface. Are you communicating to Outlook via ActiveX?

Rob

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Shaun,

I guess I should've clarified... You may need one for an ActiveX interface. Are you communicating to Outlook via ActiveX?

Rob

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Rob,

I'm doing this part way though the code.

CREATE APPLICATION OF OUTLOOK HANDLE IN OUTLOOK-HANDLE
MODIFY OUTLOOK-HANDLE, CREATEITEM (OLMAILITEM) GIVING
MAIL-HANDLE
MODIFY MAIL-HANDLE @SUBJECT "Purchase Order"
MODIFY MAIL-HANDLE @TO WS-EMAIL-ADDRESS
MAIL-HANDLE ATTACHMENTS IN ATTACH-HANDLE
MODIFY ATTACH-HANDLE @ADD(WS-EMAIL-ATTACHMENT,
OLBYVALUE, 1, "SEE ATTACHMENT")
MODIFY MAIL-HANDLE @SEND()
DESTROY MAIL-HANDLE

It then comes up with a COBOL error, terminates and takes you back to the calling program.
This PO print program is called in a thread from elsewhere.

Shaun

[Migrated content. Thread originally posted on 10 February 2006]

Hi,

We have out application sending emails via MS outlook thanks to some examples on here.

All works well, except outlook complains that something is trying to send a mail etc.
I personally don't really mind this, but if the persons decides to refuse the request to send the mail, then our application crashes.

How can I find out why its crashing, and more importantly just ignore the fact that the request was denied. i.e. don't care about the mail and let it carry on doing the things it needs to do.
Thanks,

Shaun

V6.1.0 at present by the way, soon to move to 7.0.1.
Shaun,

The problem probably is because when you create the Outlook mail item, it fails because the user says no. Then, when the program attempts to modify that handle with subject, etc, the handle is not there.

So, to use an exception procedure, you would put something like this in your declaratives section:

OBJECT-EXCEPTION-HANDLING SECTION.
USE AFTER EXCEPTION ON OBJECT.
OBJECT-EXCEPTION-HANDLER.
CALL "C$EXCEPINFO" USING ERROR-INFO, WS-ERR-SOURCE, WS-ERR-DESCRIPTION.
IF ERROR-INFO-CODE = nnn
Then do whatever...
END-IF.

So, when an exception is raised by Outlook, it will go into this procedure. You can use "C$EXCEPINFO" to determine what the error is and then act accordingly. So, you could set a flag that an error occured and then in your code after "MODIFY OUTLOOK-HANDLE, CREATEITEM (OLMAILITEM) GIVING MAIL-HANDLE", you could test that flag and get out if it's set. If you don't care what the error is, you don't even have to do the "C$EXCEPINFO".

Let me know if this doesn't make sense. Hope it helps...

Rob