| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 
 | function EnvoyerMail( const SDestinataire, SSujet, STexte : String;
                      LFichiers: TStringList;
                      BAfficherErreur : Boolean = True;
                      BEnvoiAuto : Boolean = False ) : Boolean;
var
   DD : MapiRecipDesc; // description destinataire
   DF : array[ 0..49 ] of MapiFileDesc; // description fichier, 50 maxi.
   DM : MapiMessage; // description du message
   IError : Cardinal;
   MailHandle : THandle;
   i: Integer;
begin
.../
     if MailLogon( MailHandle, BAfficherErreur ) then
       try
       // Envoi du mail
       if BEnvoiAuto
         then IError := MapiSendMail( MailHandle, Application.Handle, DM, 0, 0 )
         else IError := MapiSendMail( MailHandle, Application.Handle, DM, MAPI_DIALOG , 0 );
       Result := SErreurSendMail( IError ) = '';
       if ( not Result ) and BAfficherErreur
         then ShowMessage( 'ERREUR d''envoi du mail vers ' + SDestinataire + #13 +
                           SErreurSendMail( IError ) );
       finally MailLogoff( MailHandle ); end;
     // Libérations
     for i := 0 to LFichiers.Count - 1 do
       begin
       StrDispose( DF[ i ].lpszPathName );
       StrDispose( DF[ i ].lpszFileName );
       end;
end; | 
Partager