I've got a problem with e-mail creating.
First at all, for creating an e-mail I don't use CodeUnit397, I use my own one based on Microsoft MAPI Messages Control, version 6.0 &
Microsoft MAPI Session Control, version 6.0
The problem appear when the e-mail is allready created with program code and I'm gonna decide if it has to be sent or just showed on the Outlook window as new e-mail.
It can be provided by code:
IF OpenDialog THEN
MAPImessages.Action(2) // Open window
ELSE
MAPImessages.Action(3); // Send direcly
Now the proble....
If I show the Outlook window and doesn't send the mail, just close the window, ERROR message is generated in Navision like that: "User cancelled process". I think it is because Oulook is opened modally and MAPImessages.Action(2) gives back this error message.
So... Is it possible to do something??
0
Comments
And could you post more (all) code?
If it was hard to write, it should be hard to understand."
The source code is:
NoOfAttachment := 0;
NoOfRecipients := 0;
MAPISession.DownLoadMail := FALSE;
IF MAPISession.SessionID = 0 THEN
MAPISession.SignOn;
MAPImessages.SessionID := MAPISession.SessionID;
MAPImessages.Compose;
MAPImessages.RecipIndex := NoOfRecipients;
MAPImessages.RecipType := 1;
MAPImessages.RecipDisplayName := ToName;
IF Buffer.FIND('-') THEN
REPEAT
MAPImessages.AttachmentIndex := NoOfAttachment;
MAPImessages.AttachmentType := 0;
MAPImessages.AttachmentPathName := AttachFileName;
NoOfAttachment := NoOfAttachment + 1;
UNTIL Buffer.NEXT = 0;
IF OpenDialog THEN
MAPImessages.Action(2) // open window
ELSE
MAPImessages.Action(3); // send
I could be completely wrong, but maybe you could give it a shot.
If it was hard to write, it should be hard to understand."
IF ISCLEAR(aut_MAPIHandler) THEN
CREATE(aut_MAPIHandler);
int_ErrorNo := 0;
aut_MAPIHandler.ToName := 'someone@somecompany.com';
aut_MAPIHandler.Subject := 'something'
aut_MAPIHandler.AddBodyText('something else');
aut_MAPIHandler.OpenDialog := TRUE;
aut_MAPIHandler.Send;
int_ErrorNo := aut_MAPIHandler.ErrorStatus;
IF int_ErrorNo <> 0 THEN error('error occured');
Benny Giebens
You have got right... but this source code doesn't allow you send more than 1 attachment file per e-mail.
If you use automation, you have very nice formatted body text with more than 1025 chars, but only 1 attachment
If you use the other way, you have multiple attachments, but very limited ways of formatting your body tekst and limited chars...
If navision could be so kind to put both nice things in ONE method... we wouldn't complain anymore (for the mapi things... al the other things... \:D/
Benny Giebens
I don't need use the body text. Everything what I need is:
-generate more then 1 recipient per 1 e-mail
-generate more then 1 attachment file per 1 e-mail
Standard codeunit397 doesn't allow this. This is a reason why I have to use
Microsoft MAPI Messages Control, version 6.0 and
Microsoft MAPI Session Control, version 6.0
But with this metode I've got the problem described couple of messages before.