Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Colaboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 03-01-2005
Kamikaze Kamikaze is offline
Miembro
 
Registrado: abr 2004
Posts: 30
Poder: 0
Kamikaze Va por buen camino
Question ¿Where is the mistake?

Hola a todos, mi problema es que estoy teniendo un problemilla a la hora de
descargarme los emails y me gustaria que si alguien sabe un poco del tema
que le eche un vistazo al codigo.

Muchas gracias!!!!



Código PHP:
unit Unit1;
interface
uses
Windows
, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
 
IdMessageClient, IdPOP3, StdCtrls, IdMessage;

type
  TForm1 
= class(TForm)
    
IdPOP31: TIdPOP3;
    
IdMessage1: TIdMessage;
    
Button1: TButton;
    
Memo1: TMemo;
    
procedure IdPOP31Connected(Sender: TObject);
    
procedure Button1Click(Sender: TObject);
  private
    { Private 
declarations }
  public
    { Public 
declarations }
  
end;
var
  
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.IdPOP31Connected(Sender: TObject);
begin
IdPOP31
.Host := 'pop3.terra.es';
IdPOP31.Username := 'acid_explosion.terra.es';
IdPOP31.Password := '******************'; 
//¿el fallo podria ser del servidor?:confused: 
end;
procedure TForm1.Button1Click(Sender: TObject);
var
pop3mailcounttotalI : integer;
pop3mailboxsizetotalI : integer;
I : integer;
J : integer;
K : integer;
bodyS : TStringList;
s : string;
Msg: TIdMessage;
begin
 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
   // BodyS.Clear;
   // ShowMessage( IdMessage1.MsgId );
   // ShowMessage( IdMessage1.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 );
     
// s := s + ' ' +  TIdText( IdMessage1.MessageParts.Items[ J ]).Body.Text;
    
end;
   
end;
   
// .Add(TmpStr + '|' + StringReplace(BodyS.Text, #13#10, '^', [rfReplaceAll]));
   //  MsgList.Add(TmpStr);
   // ShowMessage( s );
   
ShowMessage( BodyS.Text );
   }
    
Msg.NoDecode := false;
    
//
    // Msg.NoDecode := true; // this does certainly not work
    //
    
BodyS.Clear;
    
// Memo1.Clear;
    
ShowMessage( Msg.ContentType );
    for 
J := 0 to Pred( Msg.MessageParts.Count) do
    
begin
      
//general attachments
      
if ( Msg.MessageParts.Items[J] is TIdAttachment ) then
      begin
        
// lstAttachments.Add(TIdAttachment( Msg.MessageParts.Items [J]).Filename);
      
end
      
//body text
      
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;
end. 
P.D.: Si alguien dispone de un codigo mejor o mas elaborado que este, le
agradeceria mucho que me lo enviara.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 18:09:00.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi