Highlighted
Absent Member.
Absent Member.
3750 views

[archive] MAPI Emailing -error codes

[Migrated content. Thread originally posted on 01 April 2003]

I have modified the acucobol email program that interfaces with microsofts Mapi.

everything works fine in-house but when I sent it to a customer using an older version of outlook he gets the MAPI message

"Bad recipient type" anyone know what causes that or how we could code to get around it.
0 Likes
19 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

May we see the address you're using, feel free to obfuscate it, but keep the formatting. Complete code would be fine. Btw, does it work with other external adresses?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

the trick is everything works fine in house with XP/2000 computers with outlook XP and 2000.

customer has 2000 with outlook 2000 and his gives the message.

support@execu-tech.com was the email we asked the customer to use when he gets the error.


here is the compile switches for the menumapi.cbl program

ccbl32 -V -VE3 -CR -CH -Za -Dw32 -Dl4 -Z50 -Lf
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

Hm....
I must confess that it isn't much to recognize here from the original source that accompanied my article back then a few years ago. And it is not your fault, it differs on our web. Got to take a look at that.
Anyway, this code works as you probably know by now (note that I only posted the MAIN-LOGIC section and I have removed the linkage part for simplicity):

MAIN-LOGIC SECTION.
MAIN-LOGIC-001.

PERFORM MSMAPI-INIT.
MOVE MAPI-AUTOLOGON TO PREFERRED-LOGON
PREFERRED-SEND
PREFERRED_RESOLVE.
STRING "Ryan S. Neves" LOW-VALUES DELIMITED BY Size
INTO ORG-NAME.
STRING "SMTP:ryanneves@execu-tech.com"
LOW-VALUES DELIMITED BY Spaces
INTO ORG-ADDRESS.
PERFORM MSMAPI-LOGON.
STRING "support@execu-tech.com"
LOW-VALUES DELIMITED BY Spaces
INTO REC-NAME.

PERFORM MSMAPI-RESOLVE-REC.

IF MSG-REC-COUNT NOT = 0
STRING
"This email is sent from a COBOL Program."
X"0A"
"Acucorp extends legacy applications into the modern"
X"0A"
"computing environment."
X"0A"
LOW-VALUES
DELIMITED BY SIZE
INTO MAPI-NOTETEXT
STRING "Hello from ACUCOBOL-GT"
LOW-VALUES DELIMITED BY SIZE
INTO MAPI-SUBJECT
PERFORM MSMAPI-SEND.

PERFORM MSMAPI-MSG-INIT.
PERFORM MSMAPI-LOGOFF.
PERFORM MSMAPI-SHUTDOWN.

MAIN-LOGIC-900.
*
****************
*
STOP RUN.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

THE CODE YOU SEND IS WHAT I AM USING

something in the

PERFORM MSMAPI-SEND.

is creating the error.,
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

It is not the same as the code you sent.

For one, because I know it is different.

For two, because I am able to email your support.

First, pick your original menumapi.cbl.

Second, go to line 52 and tell me why do you put the subject into the originator name (ORG-NAME). If you look at my code, I put a name into the ORG-NAME.

Third, look at the STRING sentence where you insert the originator address, you use the phrase BY SIZE, you should rather use BY SPACE to avoid trailing spaces which may make mapi confused. this counts for all address fields, of course for subject lines you don't do this because they may have embedded spaces.

Fourth, go to line 59, why do you set recipient name (REC-NAME) to the same as originator? If you look at my code, I am using support@execu-tech.com here.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

Hello Gisle, Ryan and others

Thank you for the discussion. I have tried the attached program and it is working fine on my developer maschine, but I haven't tried it on our customers maschines yet. But a little question, is there a way to "start" the email and present it for the user without sending it automatic. I would like to give the user a opportunity for editing it.

Regards

Steen Jensen

sgj@datamann.dk

Datamann, denmark
🙂
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

yes, I've made some mods to the program since I last posted....I will find out what the change was and let you know.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

What you can do to have the entire message dialog show, is to change the value of a particular parameter in msmapi.cpy.

Look for the section MSMAPI-SEND,

Set the parameter PREFERRED-SEND to MAPI-DIALOG (8), once you call MapiSendMail, this should bring up a dialog.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

Thank you Gisle

The

MOVE MAPI-DIALOG TO PREFERRED-SEND

is working fine.

But another question. I am not able to make this functioning with outlook express, is that correct ?? (or is it my customers maschine)

I have know realised that I could also use this mehod

MAILTO:SGJ@DATAMANN.DK?subject=test file & body=body text message :"c:\bat\ucob.bat"

the :"c:\bat\ucob.bat" is the attached file.

Very handy and should work on alle mail programs, but is this a solution ??

As I can see one problem is that this solution is not sendning automatic, but only starting up a mail.



Regards

Steen Jensen
sgj@datamann.dk
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

I've had the same problem with express your Mailto: work around will work for me....thank you much

But I can't seem to get the c$system to execute the command.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MAPI Emailing -error codes

Hello Ryan

This is a program that I am using right now. I have not included the attached file yet, while I have just know found out of that solution. But the program should work as it is. As I can see we are using the c$run instead of system

There is some work with the registrationdatabase and I don't know exactly what is going on (one of my colleague's have made the program) but I think it is okay.

Fell free to use it If yout want. Maybe you could mail me if you finds out of something new.

Unfortunately some of the program explanation is on danish, sorry



Regards

Steen Jensen
datamann
Denmark
Sgj@datamann.dk
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.