Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IdIMAP41.Host := 'imap.ukr.net';
- IdIMAP41.Username := 'login@ukr.net';
- IdIMAP41.Password := 'password';
- IdIMAP41.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(IdIMAP41);
- IdIMAP41.UseTLS := utUseImplicitTLS;
- IdIMAP41.Connect();
- try
- IdIMAP41.SelectMailBox('INBOX');
- idIMAP41.Retrieve(IdIMAP41.MailBox.TotalMsgs, idMessage1);
- for i := 1 to IdIMAP41.MailBox.TotalMsgs - 1 do
- begin
- idIMAP41.DeleteMsgs(i);
- idIMAP41.ExpungeMailBox;
- end;
- finally
- IdIMAP41.Disconnect;
- IdIMAP41.IOHandler.Free;
- end;
- for n := 0 to IdMessage1.MessageParts.Count - 1 do
- begin
- ttype := idMessage1.MessageParts[n].ClassName;
- if (ttype = 'TIdText') and not (ttype = NULL) then
- begin
- messtext2 := TIdText(idMessage1.MessageParts.Items[n]).Body.Text;
- end;
- atype := idMessage1.MessageParts[n].ClassName;
- if atype = 'TIdAttachmentFile' then
- begin
- aname := IdMessage1.MessageParts.Items[n].FileName;
- if aname = '' then
- aname := 'unknown_file';
- attach := TIdAttachment(IdMessage1.MessageParts.Items[n]);
- attach.SaveToFile(aname);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement