View Single Post
Eski 08/11/2004, 13:49   #2 (permalink)
sadettinpolat
Üye
 
Üyelik Tarihi: 06/2004
Mesaj: 67
Varsayılan

ben bu şekilde yapmıştım. burası biraz karışık gibi görünüyor ama maildeki eki nasıl alman gerektiğini burdan çıkartabilirsin....

procedure TThread1.RetrievePOPHeaders(MesajSayisi: Integer);
var
stTemp: string;
intIndex,intindex2: integer;
itm: TListItem;
DosyaAdi,DosyaPath, FirmaKodu : String;
Tarih:_systemtime;
Kaydet:TFileName;
begin
ToplamBoyut:=0;
GetSystemTime(Tarih);
form1.Label9.Caption:='Toplam Gelen E-Posta Sayısı:' + inttostr(MesajSayisi);
for intIndex := 1 to MesajSayisi do
begin
idMessage2.Clear;
idPOP32.RetrieveHeader(intIndex, idMessage2);
If IdMessage2.Subject = 'XXXX' Then
Begin
itm := Form1.ListView1.Items.Add;
itm.Caption := IdMessage2.Subject;
itm.SubItems.Add(IntToStr(idPOP32.RetrieveMsgSize( intIndex)));
itm.SubItems.Add(inttostr(intIndex));
itm.SubItems.Add(' ');
ToplamBoyut := ToplamBoyut + idPOP32.RetrieveMsgSize(intIndex);
End; //if
end; //for

form1.Label1.Caption := 'Gelen Veri Sayısı:' + IntToStr(Form1.ListView1.Items.Count);
form1.Label2.Caption := 'Toplam Boyut:'+inttostr(ToplamBoyut)+' Byte';
Toplam := form1.ListView1.Items.Count;
for intIndex := 0 to form1.ListView1.Items.Count - 1 Do
Begin
form1.Memo1.Lines.Add('Veri Dosyaları Ayıklanıyor...');
Alinan := intindex+1;
Synchronize(alinanmail);
idPOP32.Retrieve(StrToInt(form1.ListView1.Items[intIndex].SubItems.Strings[1]), idMessage2);
for intIndex2 := 0 to Pred(idMessage2.MessageParts.Count) do
begin
if (idMessage2.MessageParts.Items[intIndex2] is TIdAttachment) then
begin
DosyaAdi :=TIdAttachment(idMessage2.MessageParts.Items[intIndex2]).Filename;
FirmaKodu := Copy(DosyaAdi,1,Pos(' and ',DosyaAdi)-1);
Form1.ListView1.Items[intIndex].SubItems.Strings[2] := FirmaKodu;
DosyaPath :=ExtractFilePath(Application.ExeName) +'Firma\' + FirmaKodu + '\' + inttostr(tarih.wYear) + '\';
form1.Memo1.Lines.Add(DosyaAdi);
if Not DirectoryExists(DosyaPath) Then
Begin
if Not DirectoryExists(ExtractFilePath(Application.ExeNam e)+'firma') Then
CreateDir(ExtractFilePath(Application.ExeName)+'fi rma');

If Not DirectoryExists(ExtractFilePath(Application.ExeNam e)+'firma\' + FirmaKodu) Then
CreateDir(ExtractFilePath(Application.ExeName)+'fi rma\'+FirmaKodu);

CreateDir(DosyaPath);

End;

Kaydet := DosyaPath+DosyaAdi;

If FileExists(DosyaPath+DosyaAdi) Then
DeleteFile(DosyaPath+DosyaAdi);
form1.Label9.Caption :='Veri Dosyası Bilgisayarınıza Kaydediliyor...';

--------------->
If Not TIdAttachment(idMessage2.MessageParts.Items[intindex2]).SaveToFile(Kaydet) Then
begin
MsgId:=3;
Synchronize(UpdateProgressBar);
Exit;
End;

end;
End;
form1.Gauge1.Progress := 100;
if form2.CheckBox1.Checked Then
Begin
form1.Label9.Caption :='Veri Dosyası Sunucudan Siliniyor...';
IdPop32.Delete(StrToInt(form1.ListView1.Items[intIndex].SubItems.Strings[1]));
End;
End;
end;
sadettinpolat hatta değil   Alıntı Yaparak Yanıtla