InternetMail.DeleteMessages

Syntax:

DeleteMessages(<DataArray>)

Parameters:

<DataArray> (required)

Type: Array.
Array, containing message headers or server identifiers of messages to delete from the server.
When operating using the IMAP protocol it is allowed to pass an array of sequence number of messages (integers) in the current mail box (CurrentMailbox).

Description:

Using POP3 deletes all specified messages from the server. Messages are specified either by InternetMailMessage objects, or by identifiers from the array, assigned as parameter.
Using IMAP marks all the messages which are specified with one of the following ways as deleted from the server:
  • InternetMailMessage objects,
  • identifiers in an array which is accepted as a parameter,
  • ordinal numbers of the messages in the current mail box which is specified in the CurrentMailbox property.
Marked messages can be permanently deleted using the ClearDeletedMassages method or unmarked for deletion using the UndeleteMessages method.

Availability:

Thin client, server, thick client, external connection, Mobile application (client), Mobile application (server).

Example:

Profile = New InternetMailProfile;
FillIn(Profile);

Mail = New InternetMail;
Mail.Logon(Profile);

Array = Mail.Get(False);

ArrMess   = New Array;
ArrUID = New Array;

For 
Num = 0 To Array.Count() - 1 Do

    If 
Int(Num / 2) = Num / 2 Then

        ArrMess.Add(Array[Num]);

    Else

        ArrUID.Add(Array[Num].UID[0]);

    EndIf
;

EndDo
;

Mail.DeleteMessages(ArrMess);
Mail.DeleteMessages(ArrUID);

Mail.Logoff();


    

1C:Enterprise Developer's Community