Home:www.CarozoDeQuilmes.com.ar
SplitMail
This program Compress, Split and Send Files and Directory's by eMail with Attach (Only Default Email Client).
Free Download: SplitMail versión 01.08.00
Comentarios y/o reportes de Bug's: CarozoDeQuilmes@gmail.com
Este es el código con el cual envia el mail al cliente por defecto:
........
// MAPI
with Confirm
rta:=US_MAPISendMail(0, cTitulo,
cTexto, cOrigName, cOrigAddress, cDestName, cDestAddress, cAttachFile,
8)
// MAPI
withOUT Confirm
rta:=US_MAPISendMail(0, cTitulo,
cTexto, cOrigName, cOrigAddress, cDestName, cDestAddress, cAttachFile,
0)
........
#pragma
BEGINDUMP
#include
<windows.h>
#include
<stdio.h>
#include
<mapi.h>
#include
<mapix.h>
HINSTANCE hMAPILib =
0;
LHANDLE
hSession = 0;
LPMAPILOGON
pMAPILogon = NULL;
LPMAPILOGOFF
pMAPILogoff =
NULL;
LPMAPISENDMAIL pMAPISendMail =
NULL;
MapiRecipDesc orig ;
MapiRecipDesc rcpt ;
MapiFileDesc
file ;
MapiMessage
mssg ;
HB_FUNC (
US_MAPISENDMAIL )
{
int nModoDialog = hb_parni(
9 ) ;
orig.ulReserved
=
0
; //
Reserved
orig.ulRecipClass =
MAPI_ORIG ; // Reciepient Class MAPI_TO MAPI_CC
MAPI_BCC
orig.lpszName
= hb_parc( 4 ) ; //
Originator's Name
orig.lpszAddress =
hb_parc( 5 ) ; // Originators
Address
orig.ulEIDSize
= 0
; // Count in bytes of size
of pEntryID
orig.lpEntryID
= 0
; // System-specific
Originator reference
rcpt.ulReserved
=
0
; //
Reserved
rcpt.ulRecipClass =
MAPI_TO
; // Reciepient Class
MAPI_TO MAPI_CC MAPI_BCC
rcpt.lpszName
= hb_parc( 6 ) ; //
Reciepient's Name, e.g., pepe@hotmail.com
rcpt.lpszAddress =
hb_parc( 7 ) ; // Reciepient's
Address
rcpt.ulEIDSize = 0
; // Count in bytes of size
of pEntryID
rcpt.lpEntryID
= 0
; // System-specific
Recipient reference
file.ulReserved
=
0
; // Reserved for future
usage
file.flFlags
= 0
; // Flags
?
file.nPosition
= -1
; // Character of text to be
replaced by attachment
file.lpszPathName = hb_parc(
8 ) ; // Full Path Name with
Extension of the attached file
file.lpszFileName = 0
; // Original File Name (
optional )
file.lpFileType
=
0
; // Attachment file type (
can be lpMapiFileTagExt )
mssg.ulReserved
=
0
; //
Reserved
mssg.lpszSubject =
hb_parc( 2 ) ; // Message
Subject
mssg.lpszNoteText = hb_parc(
3 ) ; // Message
Text
mssg.lpszMessageType = 0
; // Message
Class
mssg.lpszDateReceived = 0
; // in yyyy/mm/dd hh:mm
format
mssg.lpszConversationID =
0
; // Conversation thread
ID
mssg.flFlags
= MAPI_LOGON_UI | MAPI_NEW_SESSION; // unread, return
receipt
mssg.lpOriginator =
&orig
; // Originator's
descriptor
mssg.nRecipCount =
1
; // Number of
receipients
mssg.lpRecips
= &rcpt
; // Recipient
descriptors
mssg.nFileCount
=
1
; // Number of file
attachments
mssg.lpFiles
= &file
; // Attachment
descriptors
// Load the DLL at
runtime
hMAPILib =
::LoadLibrary("MAPI32.DLL");
if
(!hMAPILib)
{
hb_retnl( 101 ); //
failed
return;
}
if (!(pMAPILogon =
(LPMAPILOGON) GetProcAddress (hMAPILib,
"MAPILogon")))
{
hb_retnl( 102 ); //
failed
return;
}
if (!(pMAPISendMail =
(LPMAPISENDMAIL) GetProcAddress (hMAPILib,
"MAPISendMail")))
{
hb_retnl( 103 ); //
failed
return;
}
if (!(pMAPILogoff =
(LPMAPILOGOFF) GetProcAddress (hMAPILib,
"MAPILogoff")))
{
hb_retnl( 104 ); //
failed
return;
}
//
logon
if (pMAPILogon(0, NULL,
NULL, MAPI_LOGON_UI | MAPI_NEW_SESSION, 0, &hSession) !=
SUCCESS_SUCCESS)
{
hb_retnl( 105 );
// Logon failed
return;
}
// Send email using the
MAPISendMail API function
if (nModoDialog ==
0)
{
hb_retnl (pMAPISendMail(hSession, 0, &mssg, 0, 0))
;
}
else
{
if
(nModoDialog == 8)
{
hb_retnl (pMAPISendMail(hSession, 0, &mssg, MAPI_DIALOG, 0))
;
}
else
{
hb_retnl( 108 );
// invalid parameter
}
}
// Logoff
session
pMAPILogoff(hSession, 0, 0,
0);
// Free
DLL
::FreeLibrary(hMAPILib);
return;
}
#pragma ENDDUMP