MailGetFilesCount

Top  Previous  Next

Prototype

 

IntValue:=MailGetFilesCount(intMailHandle)

 

Description

 

Gets number of attachment in a mail.

 

Parameters

 

intMailHandle: integer value corresponding to the handle of the mail.

 

Returned value

 

IntValue:integer value corresponding to the number of attachment.

 

Notes

 

None.

 

Example

 

//It opens an email

HandleEMail:=MailOpen('c:\Myemail.eml');

 

// It calculates the attachment

Allegati:=MailGetFilesCount(HandleEMail);

if Allegati>0 then

 begin

    for i:=0 to Allegati-1 do

      begin

        //It saves attachment

        NomeAllegato:=MailGetFileName(HandleEMail,i);

        MailGetFileAs(HandleEMail,i,'c:\'+NomeAllegato);

      end;

    ShowMessage('Gli allegati sono stati salvati nella directory c:\temp');

 end

else ShowMessage('Non ci sono allegati !');