Board index » delphi » OLE Auotmation - OUTLOOK- problem sending PDF attachment files

OLE Auotmation - OUTLOOK- problem sending PDF attachment files


2003-10-17 06:44:00 AM
delphi209
When we send pdf attachment files via Outlook... if the email receiver is
using Unix or AOL, the pdf file and heading is mixed in with the email
message.
How do I do this properly?
Any idea how I use/set the MAPIFileTagExt and MAPIFileDesc,
i.e ....fill in the parameters properly for a PDF attachement ?
The following is the code snippet I am using........THANKS !!!!
function TfrmNReportSel.SendMailMAPI(const FileName: String) : Integer;
var
message: TMapiMessage;
lpRecepient: TMapiRecipDesc;
FileAttach: TMapiFileDesc;
SM: TFNMapiSendMail;
MAPIModule: HModule;
begin
FillChar(message, SizeOf(message), 0);
with message do begin
if (fSubjectLine<>'') then begin
lpszSubject := PChar(fSubjectline);
lpszNoteText := PChar(fSubjectline); //Body
end;
if (CurrRptDest<>'') then begin
lpRecepient.ulRecipClass := MAPI_TO;
if (CurrRptDest='') then
lpRecepient.lpszName := PChar(CurrRptDest);
lpRecepient.lpszAddress := PChar('SMTP:'+CurrRptDest);
lpRecepient.ulReserved := 0;
lpRecepient.ulEIDSize := 0;
lpRecepient.lpEntryID := nil;
nRecipCount := 1;
lpRecips := @lpRecepient;
end
else
lpRecips := nil;
if (FileName='') then begin
nFileCount := 0;
lpFiles := nil;
end
else begin
FillChar(FileAttach, SizeOf(FileAttach), 0);
FileAttach.nPosition := Cardinal($FFFFFFFF);
FileAttach.lpszPathName := PChar(FileName);
nFileCount := 1;
lpFiles := @FileAttach;
end;
end;
MAPIModule := LoadLibrary(PChar(MAPIDLL));
if MAPIModule=0 then
Result := -1
else begin
try
@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
if @SM<>nil then
Result := SM(0, Application.Handle, message, MAPI_DIALOG or
MAPI_LOGON_UI, 0)
else
Result := 1;
finally
FreeLibrary(MAPIModule);
end;
end;
if Result<>0 then
MessageDlg('Error sending mail ('+IntToStr(Result)+').', mtError,
[mbOk],
0);
end;
 
 

Re:OLE Auotmation - OUTLOOK- problem sending PDF attachment files

What do you mean by "the pdf file and heading is mixed in with the email
message"?
Dmitry Streblechenko (MVP)
www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"ray sjodin" <XXXX@XXXXX.COM>writes
Quote
When we send pdf attachment files via Outlook... if the email receiver is
using Unix or AOL, the pdf file and heading is mixed in with the email
message.

How do I do this properly?

Any idea how I use/set the MAPIFileTagExt and MAPIFileDesc,
i.e ....fill in the parameters properly for a PDF attachement ?

The following is the code snippet I am using........THANKS !!!!

function TfrmNReportSel.SendMailMAPI(const FileName: String) : Integer;
var
message: TMapiMessage;
lpRecepient: TMapiRecipDesc;
FileAttach: TMapiFileDesc;
SM: TFNMapiSendMail;
MAPIModule: HModule;
begin
FillChar(message, SizeOf(message), 0);
with message do begin
if (fSubjectLine<>'') then begin
lpszSubject := PChar(fSubjectline);
lpszNoteText := PChar(fSubjectline); //Body
end;
if (CurrRptDest<>'') then begin
lpRecepient.ulRecipClass := MAPI_TO;
if (CurrRptDest='') then
lpRecepient.lpszName := PChar(CurrRptDest);
lpRecepient.lpszAddress := PChar('SMTP:'+CurrRptDest);
lpRecepient.ulReserved := 0;
lpRecepient.ulEIDSize := 0;
lpRecepient.lpEntryID := nil;
nRecipCount := 1;
lpRecips := @lpRecepient;
end
else
lpRecips := nil;
if (FileName='') then begin
nFileCount := 0;
lpFiles := nil;
end
else begin
FillChar(FileAttach, SizeOf(FileAttach), 0);
FileAttach.nPosition := Cardinal($FFFFFFFF);
FileAttach.lpszPathName := PChar(FileName);
nFileCount := 1;
lpFiles := @FileAttach;
end;
end;
MAPIModule := LoadLibrary(PChar(MAPIDLL));
if MAPIModule=0 then
Result := -1
else begin
try
@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
if @SM<>nil then
Result := SM(0, Application.Handle, message, MAPI_DIALOG or
MAPI_LOGON_UI, 0)
else
Result := 1;
finally
FreeLibrary(MAPIModule);
end;
end;
if Result<>0 then
MessageDlg('Error sending mail ('+IntToStr(Result)+').', mtError,
[mbOk],
0);
end;





 

Re:OLE Auotmation - OUTLOOK- problem sending PDF attachment files

The information from the pdf header is in the message.
The attachment is no longer an attachment, it is part of the mail message.
And you do not know where one starts and the other ends.
These are reports being sent to their customers, and of course they are
worthless.
This only happens when the receiver is using Unix or AOL... which many, if
not most, are.
Those with Outlook have no problem receiving Mapi emails sent with the
procedure.
"Dmitry Streblechenko" <XXXX@XXXXX.COM>writes
Quote
What do you mean by "the pdf file and heading is mixed in with the email
message"?

Dmitry Streblechenko (MVP)
www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"ray sjodin" <XXXX@XXXXX.COM>writes
news:3f8f1f2f$XXXX@XXXXX.COM...
>When we send pdf attachment files via Outlook... if the email receiver
is
>using Unix or AOL, the pdf file and heading is mixed in with the email
>message.
>
>How do I do this properly?
>
>Any idea how I use/set the MAPIFileTagExt and MAPIFileDesc,
>i.e ....fill in the parameters properly for a PDF attachement ?
>
>The following is the code snippet I am using........THANKS !!!!
>
>function TfrmNReportSel.SendMailMAPI(const FileName: String) : Integer;
>var
>message: TMapiMessage;
>lpRecepient: TMapiRecipDesc;
>FileAttach: TMapiFileDesc;
>SM: TFNMapiSendMail;
>MAPIModule: HModule;
>begin
>FillChar(message, SizeOf(message), 0);
>with message do begin
>if (fSubjectLine<>'') then begin
>lpszSubject := PChar(fSubjectline);
>lpszNoteText := PChar(fSubjectline); //Body
>end;
>if (CurrRptDest<>'') then begin
>lpRecepient.ulRecipClass := MAPI_TO;
>if (CurrRptDest='') then
>lpRecepient.lpszName := PChar(CurrRptDest);
>lpRecepient.lpszAddress := PChar('SMTP:'+CurrRptDest);
>lpRecepient.ulReserved := 0;
>lpRecepient.ulEIDSize := 0;
>lpRecepient.lpEntryID := nil;
>nRecipCount := 1;
>lpRecips := @lpRecepient;
>end
>else
>lpRecips := nil;
>if (FileName='') then begin
>nFileCount := 0;
>lpFiles := nil;
>end
>else begin
>FillChar(FileAttach, SizeOf(FileAttach), 0);
>FileAttach.nPosition := Cardinal($FFFFFFFF);
>FileAttach.lpszPathName := PChar(FileName);
>nFileCount := 1;
>lpFiles := @FileAttach;
>end;
>end;
>MAPIModule := LoadLibrary(PChar(MAPIDLL));
>if MAPIModule=0 then
>Result := -1
>else begin
>try
>@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
>if @SM<>nil then
>Result := SM(0, Application.Handle, message, MAPI_DIALOG or
>MAPI_LOGON_UI, 0)
>else
>Result := 1;
>finally
>FreeLibrary(MAPIModule);
>end;
>end;
>if Result<>0 then
>MessageDlg('Error sending mail ('+IntToStr(Result)+').', mtError,
>[mbOk],
>0);
>end;
>
>
>
>
>


 

Re:OLE Auotmation - OUTLOOK- problem sending PDF attachment files

I guess their mail clients have problems parsing the MIME parts - can you
retrieve a message with OE, RMB, Properties, Details, Message Source? I would be
curious to see if the MIME structure is corrupted.
Dmitry Streblechenko (MVP)
www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"ray sjodin" <XXXX@XXXXX.COM>writes
Quote
The information from the pdf header is in the message.
The attachment is no longer an attachment, it is part of the mail message.
And you do not know where one starts and the other ends.
These are reports being sent to their customers, and of course they are
worthless.
This only happens when the receiver is using Unix or AOL... which many, if
not most, are.
Those with Outlook have no problem receiving Mapi emails sent with the
procedure.

"Dmitry Streblechenko" <XXXX@XXXXX.COM>writes
news:3f8f28f8$XXXX@XXXXX.COM...
>What do you mean by "the pdf file and heading is mixed in with the email
>message"?
>
>Dmitry Streblechenko (MVP)
>www.dimastr.com/
>OutlookSpy - Outlook, CDO
>and MAPI Developer Tool
>
>
>"ray sjodin" <XXXX@XXXXX.COM>writes
>news:3f8f1f2f$XXXX@XXXXX.COM...
>>When we send pdf attachment files via Outlook... if the email receiver
is
>>using Unix or AOL, the pdf file and heading is mixed in with the email
>>message.
>>
>>How do I do this properly?
>>
>>Any idea how I use/set the MAPIFileTagExt and MAPIFileDesc,
>>i.e ....fill in the parameters properly for a PDF attachement ?
>>
>>The following is the code snippet I am using........THANKS !!!!
>>
>>function TfrmNReportSel.SendMailMAPI(const FileName: String) :
Integer;
>>var
>>message: TMapiMessage;
>>lpRecepient: TMapiRecipDesc;
>>FileAttach: TMapiFileDesc;
>>SM: TFNMapiSendMail;
>>MAPIModule: HModule;
>>begin
>>FillChar(message, SizeOf(message), 0);
>>with message do begin
>>if (fSubjectLine<>'') then begin
>>lpszSubject := PChar(fSubjectline);
>>lpszNoteText := PChar(fSubjectline); //Body
>>end;
>>if (CurrRptDest<>'') then begin
>>lpRecepient.ulRecipClass := MAPI_TO;
>>if (CurrRptDest='') then
>>lpRecepient.lpszName := PChar(CurrRptDest);
>>lpRecepient.lpszAddress := PChar('SMTP:'+CurrRptDest);
>>lpRecepient.ulReserved := 0;
>>lpRecepient.ulEIDSize := 0;
>>lpRecepient.lpEntryID := nil;
>>nRecipCount := 1;
>>lpRecips := @lpRecepient;
>>end
>>else
>>lpRecips := nil;
>>if (FileName='') then begin
>>nFileCount := 0;
>>lpFiles := nil;
>>end
>>else begin
>>FillChar(FileAttach, SizeOf(FileAttach), 0);
>>FileAttach.nPosition := Cardinal($FFFFFFFF);
>>FileAttach.lpszPathName := PChar(FileName);
>>nFileCount := 1;
>>lpFiles := @FileAttach;
>>end;
>>end;
>>MAPIModule := LoadLibrary(PChar(MAPIDLL));
>>if MAPIModule=0 then
>>Result := -1
>>else begin
>>try
>>@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
>>if @SM<>nil then
>>Result := SM(0, Application.Handle, message, MAPI_DIALOG or
>>MAPI_LOGON_UI, 0)
>>else
>>Result := 1;
>>finally
>>FreeLibrary(MAPIModule);
>>end;
>>end;
>>if Result<>0 then
>>MessageDlg('Error sending mail ('+IntToStr(Result)+').', mtError,
>>[mbOk],
>>0);
>>end;
>>
>>
>>
>>
>>
>
>


 

Re:OLE Auotmation - OUTLOOK- problem sending PDF attachment files

Not sure what you are asking.
OE works fine if recipeint has it.
And of course sender has it.
ONLY if the recipient HAS AOL or UNIX does it fail.
From what I understand,
MapiMessage has a parameter called lpFiles, for FileAttachments.
lpFiles is a TMapiFileDesc which is defined as follows....
MapiFileDesc = packed record
ulReserved: Cardinal; { Reserved for future use (must be 0) }
***** flFlags: Cardinal; {
} ******** see below
nPosition: Cardinal; { character in text to be replaced by
attachment }
lpszPathName: LPSTR; { Full path name of attachment file }
lpszFileName: LPSTR; { Original file name (optional) }
***** lpFileType: Pointer; { Attachment file type (can be
lpMapiFileTagExt) } **** see below
end;
TMapiFileDesc = MapiFileDesc;
flFlags
Bitmask of attachment flags. The following flags can be set:
MAPI_OLE
The attachment is an OLE object. If MAPI_OLE_STATIC is also set, the
attachment is a static OLE object. If MAPI_OLE_STATIC is not set, the
attachment is an embedded OLE object.
MAPI_OLE_STATIC
The attachment is a static OLE object.
If neither flag is set, the attachment is treated as a data file.
This is what is happening.... the attachment IS being treated as a .DAT
file!!!!
Which flag should use for PDF ????
Also......
lpFileType: Pointer; { Attachment file type (can be
lpMapiFileTagExt) }
How do I set the parameters correctly for MapiFileTagExt ?
Could you provide an example????
typedef struct {
ULONG ulReserved;
ULONG cbTag;
LPBYTE lpTag;
ULONG cbEncoding;
LPBYTE lpEncoding
} MapiFileTagExt, FAR *lpMapiFileTagExt;
Members
ulReserved
Reserved; must be zero.
cbTag
The size, in bytes, of the value defined by the lpTag member.
lpTag
Pointer to an X.400 object identifier indicating the type of the
attachment in its original form, for example "Microsoft Excel worksheet".
cbEncoding
The size, in bytes, of the value defined by the lpEncoding member.
lpEncoding
Pointer to an X.400 object identifier indicating the form in which the
attachment is currently encoded, for example MacBinary, UUENCODE, or binary.
Remarks
A MapiFileTagExt structure defines the type of an attached file for purposes
such as encoding and decoding the file, choosing the correct application to
launch when opening it, or any use that requires full information regarding
the file type. Client applications can use information in the lpTag and
lpEncoding members of this structure to determine what to do with an
attachment.
THANKS !!!!!!!
"Dmitry Streblechenko" <XXXX@XXXXX.COM>writes
Quote
I guess their mail clients have problems parsing the MIME parts - can you
retrieve a message with OE, RMB, Properties, Details, Message Source? I'd
be
curious to see if the MIME structure is corrupted.

Dmitry Streblechenko (MVP)
www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"ray sjodin" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>The information from the pdf header is in the message.
>The attachment is no longer an attachment, it is part of the mail
message.
>And you do not know where one starts and the other ends.
>These are reports being sent to their customers, and of course they are
>worthless.
>This only happens when the receiver is using Unix or AOL... which many,
if
>not most, are.
>Those with Outlook have no problem receiving Mapi emails sent with the
>procedure.
>
>"Dmitry Streblechenko" <XXXX@XXXXX.COM>writes
>news:3f8f28f8$XXXX@XXXXX.COM...
>>What do you mean by "the pdf file and heading is mixed in with the
email
>>message"?
>>
>>Dmitry Streblechenko (MVP)
>>www.dimastr.com/
>>OutlookSpy - Outlook, CDO
>>and MAPI Developer Tool
>>
>>
>>"ray sjodin" <XXXX@XXXXX.COM>writes
>>news:3f8f1f2f$XXXX@XXXXX.COM...
>>>When we send pdf attachment files via Outlook... if the email
receiver
>is
>>>using Unix or AOL, the pdf file and heading is mixed in with the
email
>>>message.
>>>
>>>How do I do this properly?
>>>
>>>Any idea how I use/set the MAPIFileTagExt and MAPIFileDesc,
>>>i.e ....fill in the parameters properly for a PDF attachement ?
>>>
>>>The following is the code snippet I am using........THANKS !!!!
>>>
>>>function TfrmNReportSel.SendMailMAPI(const FileName: String) :
Integer;
>>>var
>>>message: TMapiMessage;
>>>lpRecepient: TMapiRecipDesc;
>>>FileAttach: TMapiFileDesc;
>>>SM: TFNMapiSendMail;
>>>MAPIModule: HModule;
>>>begin
>>>FillChar(message, SizeOf(message), 0);
>>>with message do begin
>>>if (fSubjectLine<>'') then begin
>>>lpszSubject := PChar(fSubjectline);
>>>lpszNoteText := PChar(fSubjectline); //Body
>>>end;
>>>if (CurrRptDest<>'') then begin
>>>lpRecepient.ulRecipClass := MAPI_TO;
>>>if (CurrRptDest='') then
>>>lpRecepient.lpszName := PChar(CurrRptDest);
>>>lpRecepient.lpszAddress := PChar('SMTP:'+CurrRptDest);
>>>lpRecepient.ulReserved := 0;
>>>lpRecepient.ulEIDSize := 0;
>>>lpRecepient.lpEntryID := nil;
>>>nRecipCount := 1;
>>>lpRecips := @lpRecepient;
>>>end
>>>else
>>>lpRecips := nil;
>>>if (FileName='') then begin
>>>nFileCount := 0;
>>>lpFiles := nil;
>>>end
>>>else begin
>>>FillChar(FileAttach, SizeOf(FileAttach), 0);
>>>FileAttach.nPosition := Cardinal($FFFFFFFF);
>>>FileAttach.lpszPathName := PChar(FileName);
>>>nFileCount := 1;
>>>lpFiles := @FileAttach;
>>>end;
>>>end;
>>>MAPIModule := LoadLibrary(PChar(MAPIDLL));
>>>if MAPIModule=0 then
>>>Result := -1
>>>else begin
>>>try
>>>@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
>>>if @SM<>nil then
>>>Result := SM(0, Application.Handle, message, MAPI_DIALOG or
>>>MAPI_LOGON_UI, 0)
>>>else
>>>Result := 1;
>>>finally
>>>FreeLibrary(MAPIModule);
>>>end;
>>>end;
>>>if Result<>0 then
>>>MessageDlg('Error sending mail ('+IntToStr(Result)+').',
mtError,
>>>[mbOk],
>>>0);
>>>end;
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>


 

Re:OLE Auotmation - OUTLOOK- problem sending PDF attachment files

What I mean is the MIME source of the message as sent by Outlook - select
any message in OE, RMB, Properties, Details, Message Source to see what I
mean.
Since OE understands it and other mail clients do not, I suspect that there
is something in the MIME structure that throws other mail clients off.
Dmitry Streblechenko (MVP)
www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"ray sjodin" <XXXX@XXXXX.COM>writes
Quote
Not sure what you are asking.

OE works fine if recipeint has it.
And of course sender has it.
ONLY if the recipient HAS AOL or UNIX does it fail.

From what I understand,
MapiMessage has a parameter called lpFiles, for FileAttachments.

lpFiles is a TMapiFileDesc which is defined as follows....

MapiFileDesc = packed record
ulReserved: Cardinal; { Reserved for future use (must be
}
***** flFlags: Cardinal; {
} ******** see below
nPosition: Cardinal; { character in text to be replaced by
attachment }
lpszPathName: LPSTR; { Full path name of attachment
}
lpszFileName: LPSTR; { Original file name
}
***** lpFileType: Pointer; { Attachment file type (can be
lpMapiFileTagExt) } **** see below
end;
TMapiFileDesc = MapiFileDesc;

flFlags
Bitmask of attachment flags. The following flags can be set:
MAPI_OLE
The attachment is an OLE object. If MAPI_OLE_STATIC is also set, the
attachment is a static OLE object. If MAPI_OLE_STATIC is not set, the
attachment is an embedded OLE object.
MAPI_OLE_STATIC
The attachment is a static OLE object.
If neither flag is set, the attachment is treated as a data file.

This is what is happening.... the attachment IS being treated as a .DAT
file!!!!

Which flag should use for PDF ????

Also......

lpFileType: Pointer; { Attachment file type (can be
lpMapiFileTagExt) }

How do I set the parameters correctly for MapiFileTagExt ?

Could you provide an example????
typedef struct {
ULONG ulReserved;
ULONG cbTag;
LPBYTE lpTag;
ULONG cbEncoding;
LPBYTE lpEncoding
} MapiFileTagExt, FAR *lpMapiFileTagExt;
Members
ulReserved
Reserved; must be zero.
cbTag
The size, in bytes, of the value defined by the lpTag member.
lpTag
Pointer to an X.400 object identifier indicating the type of the
attachment in its original form, for example "Microsoft Excel worksheet".
cbEncoding
The size, in bytes, of the value defined by the lpEncoding member.
lpEncoding
Pointer to an X.400 object identifier indicating the form in which the
attachment is currently encoded, for example MacBinary, UUENCODE, or
binary.
Remarks
A MapiFileTagExt structure defines the type of an attached file for
purposes
such as encoding and decoding the file, choosing the correct application
to
launch when opening it, or any use that requires full information
regarding
the file type. Client applications can use information in the lpTag and
lpEncoding members of this structure to determine what to do with an
attachment.

THANKS !!!!!!!


"Dmitry Streblechenko" <XXXX@XXXXX.COM>writes
news:3f902536$XXXX@XXXXX.COM...
>I guess their mail clients have problems parsing the MIME parts - can
you
>retrieve a message with OE, RMB, Properties, Details, Message Source?
I'd
be
>curious to see if the MIME structure is corrupted.
>
>Dmitry Streblechenko (MVP)
>www.dimastr.com/
>OutlookSpy - Outlook, CDO
>and MAPI Developer Tool
>
>
>"ray sjodin" <XXXX@XXXXX.COM>writes
>news:XXXX@XXXXX.COM...
>>The information from the pdf header is in the message.
>>The attachment is no longer an attachment, it is part of the mail
message.
>>And you do not know where one starts and the other ends.
>>These are reports being sent to their customers, and of course they
are
>>worthless.
>>This only happens when the receiver is using Unix or AOL... which
many,
if
>>not most, are.
>>Those with Outlook have no problem receiving Mapi emails sent with the
>>procedure.
>>
>>"Dmitry Streblechenko" <XXXX@XXXXX.COM>writes
>>news:3f8f28f8$XXXX@XXXXX.COM...
>>>What do you mean by "the pdf file and heading is mixed in with the
email
>>>message"?
>>>
>>>Dmitry Streblechenko (MVP)
>>>www.dimastr.com/
>>>OutlookSpy - Outlook, CDO
>>>and MAPI Developer Tool
>>>
>>>
>>>"ray sjodin" <XXXX@XXXXX.COM>writes
>>>news:3f8f1f2f$XXXX@XXXXX.COM...
>>>>When we send pdf attachment files via Outlook... if the email
receiver
>>is
>>>>using Unix or AOL, the pdf file and heading is mixed in with the
email
>>>>message.
>>>>
>>>>How do I do this properly?
>>>>
>>>>Any idea how I use/set the MAPIFileTagExt and MAPIFileDesc,
>>>>i.e ....fill in the parameters properly for a PDF attachement ?
>>>>
>>>>The following is the code snippet I am using........THANKS !!!!
>>>>
>>>>function TfrmNReportSel.SendMailMAPI(const FileName: String) :
>Integer;
>>>>var
>>>>message: TMapiMessage;
>>>>lpRecepient: TMapiRecipDesc;
>>>>FileAttach: TMapiFileDesc;
>>>>SM: TFNMapiSendMail;
>>>>MAPIModule: HModule;
>>>>begin
>>>>FillChar(message, SizeOf(message), 0);
>>>>with message do begin
>>>>if (fSubjectLine<>'') then begin
>>>>lpszSubject := PChar(fSubjectline);
>>>>lpszNoteText := PChar(fSubjectline); //Body
>>>>end;
>>>>if (CurrRptDest<>'') then begin
>>>>lpRecepient.ulRecipClass := MAPI_TO;
>>>>if (CurrRptDest='') then
>>>>lpRecepient.lpszName := PChar(CurrRptDest);
>>>>lpRecepient.lpszAddress := PChar('SMTP:'+CurrRptDest);
>>>>lpRecepient.ulReserved := 0;
>>>>lpRecepient.ulEIDSize := 0;
>>>>lpRecepient.lpEntryID := nil;
>>>>nRecipCount := 1;
>>>>lpRecips := @lpRecepient;
>>>>end
>>>>else
>>>>lpRecips := nil;
>>>>if (FileName='') then begin
>>>>nFileCount := 0;
>>>>lpFiles := nil;
>>>>end
>>>>else begin
>>>>FillChar(FileAttach, SizeOf(FileAttach), 0);
>>>>FileAttach.nPosition := Cardinal($FFFFFFFF);
>>>>FileAttach.lpszPathName := PChar(FileName);
>>>>nFileCount := 1;
>>>>lpFiles := @FileAttach;
>>>>end;
>>>>end;
>>>>MAPIModule := LoadLibrary(PChar(MAPIDLL));
>>>>if MAPIModule=0 then
>>>>Result := -1
>>>>else begin
>>>>try
>>>>@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
>>>>if @SM<>nil then
>>>>Result := SM(0, Application.Handle, message, MAPI_DIALOG
or
>>>>MAPI_LOGON_UI, 0)
>>>>else
>>>>Result := 1;
>>>>finally
>>>>FreeLibrary(MAPIModule);
>>>>end;
>>>>end;
>>>>if Result<>0 then
>>>>MessageDlg('Error sending mail ('+IntToStr(Result)+').',
mtError,
>>>>[mbOk],
>>>>0);
>>>>end;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>