Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.12.03;
Скачать: CL | DM;

Вниз

как отделить аттачмент?   Найти похожие ветки 

 
VajVajVaj   (2006-07-10 22:54) [0]

следующий код я использую для чтения почты:

procedure TForm1.Button1Click(Sender: TObject);
var
pop3mailcounttotalI : integer;
pop3mailboxsizetotalI : integer;
I : integer;
J : integer;
K : integer;
bodyS : TStringList;
s : string;
Msg: TIdMessage;
c:TCollection;
begin
IdPOP31.Host := "pop.yandex.ru";
IdPOP31.Port := 110;
IdPOP31.Username := "V-o-i-d-1";
IdPOP31.Password := "9632147";
bodyS := TStringList.Create;
IdPOP31.Connect;
pop3mailcounttotalI := IdPOP31.CheckMessages;
pop3mailboxsizetotalI := IdPOP31.RetrieveMailBoxSize div 1024;
ShowMessage( "Mail total =" + " " + IntToStr( pop3mailcounttotalI ) );
ShowMessage( "Mailbox size total =" + " " + IntToStr(
pop3mailboxsizetotalI ) + " " + "Kilobytes" );
for I := 1 to pop3mailcounttotalI do begin
 ShowMessage( "I =" + " " + IntToStr( I ) );
 Msg :=  TIdMessage.Create( Self );
 if IdPOP31.Retrieve( I, Msg ) then begin // add an IDMessage component from the Indy Misc tab, to initialize IdMessage1
    ShowMessage( Msg.MsgId );
   ShowMessage( Msg.Subject );

  for J := 0 to Pred( IdMessage1.MessageParts.Count ) do begin
   if ( IdMessage1.MessageParts.Items[ J ] is TIdAttachment) then
begin
    BodyS.Add( TIdAttachment(IdMessage1.MessageParts.Items[J ] ).Filename );
   end;
   if ( IdMessage1.MessageParts.Items[ J ] is TIdText ) then begin
    ShowMessage( "I am here" );
    BodyS.AddStrings( TIdText( IdMessage1.MessageParts.Items[J ]).Body );
   end;
  end;
    ShowMessage( BodyS.Text );
   Msg.NoDecode := false;
   BodyS.Clear;
    ShowMessage( Msg.ContentType );
   for J := 0 to Pred( Msg.MessageParts.Count) do
   begin
     if ( Msg.MessageParts.Items[J] is TIdAttachment ) then
     begin
    end
     else
      begin
      for K := 0 to 1 do begin
       if Msg.MessageParts.Items[J] is TIdText then begin
        Memo1.Lines.AddStrings(TIdText( Msg.MessageParts.Items[J]).Body);
        BodyS.AddStrings( TIdText( Msg.MessageParts.Items[J ]).Body );
       end;
      end;
     end;
   end;
  ShowMessage( BodyS.Text );
 end
 else begin
  ShowMessage( "Internet: E-mail: Header: Could not be retrieved" );
 end;
end;
IdPOP31.Disconnect;
end;


помогите мне пожалуйста пристроить сюда код для отделения аттачмента.


 
Slym ©   (2006-07-11 05:51) [1]

BodyS.Add( TIdAttachment(IdMessage1.MessageParts.Items[J ] ).Filename );
TIdAttachment(IdMessage1.MessageParts.Items[J ] ).SaveToFile


 
VajVajVaj   (2006-07-11 11:33) [2]

Спасибо, очень благодарен :thumbs:



Страницы: 1 вся ветка

Текущий архив: 2006.12.03;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.088 c
1-1161317574
Sergey_b
2006-10-20 08:12
2006.12.03
DRAG&DROP


2-1163667932
DoktorX
2006-11-16 12:05
2006.12.03
Можно ли распознать картинку при помощи шаблона?


15-1163501972
Crazybeaver
2006-11-14 13:59
2006.12.03
Скиньте плиз NMFTP


15-1163150916
ASoft
2006-11-10 12:28
2006.12.03
Задуматься...


3-1159527050
Sergey13
2006-09-29 14:50
2006.12.03
Оракл. DBLink на саму себя