Club Delphi  
    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

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 16-02-2010
jceluce jceluce is offline
Miembro
 
Registrado: may 2003
Ubicación: Mar del Plata - Argentina
Posts: 29
Poder: 0
jceluce Va por buen camino
Hola, te paso la formar en que yo lo hice a ver si te ayuda (no sé si cambia algun nombre o propiedad de los componentes ya que yo lo hice con las Indy8):

Saludos


Código Delphi [-]
      
     with idMessage1 do begin
        // Cuerpo del mensaje.
        Body.Clear;
        MessageParts.Clear;
        ContentType := 'text/html';


        with TIdText.Create(IdMessage1.MessageParts, nil) do begin
          Body.LoadFromFile(edFileName.Text);  // El archivo con el html
          ContentType := 'text/html';
        end;

        // Cuenta Origen.
        From.Address := FieldByName('CE_DIRECCION').AsString;
        From.Name := FieldByName('CE_NOMBRE').AsString;
        // direccion de respuesta
        ReplyTo.EMailAddresses := FieldByName('CE_RESPUESTA').AsString;
        // Asunto del email.
        Subject := edAsunto.Text;
        // Prioridad del mensaje, ALTA.
        Priority := TidMessagePriority(mpHighest);
      end;


      with idSMTP1 do begin
        // Configuro autentificación.
        AuthenticationType := atLogin;
        UserId := FieldByName('CE_SMTP_USERID').AsString;  // Nombre del usuario
        Password := FieldByName('CE_SMTP_PASSWORD').AsString;  // la password
        // Configuro el servidor SMTP.
        Host := FieldByName('CE_SMTP').AsString;
        Port := 25;

        try
          Connect;
          try
            // Envio el mensaje.
            Estado := 'Enviando emails...';

            With DM, QResult do begin
              FetchAll;

              pbProgreso.Max := RecordCount;

              if chkDestinatarios.Checked then
                MaxDestinatarios := Trunc(edMaxDest.Value)
              else
                MaxDestinatarios := RecordCount;


              // Cuenta Destino.

              idMessage1.Recipients.EMailAddresses := idMessage1.ReplyTo.EMailAddresses;

              idMessage1.BccList.Clear;
              First;
              While not EOF do begin

                pbProgreso.Position := RecNo;
                pbProgreso.Refresh;

                if ValidaEmail(FieldByName('email').AsString) then
                  With idMessage1, BCCList do begin
                    Add.Address := Trim(FieldByName('email').AsString);
                    if Count = MaxDestinatarios then begin
                      //Send(idMessage1);
                      EnviaEmail;
                      BCCList.Clear;
                    end;
                  end;

                Next;
              end;

              With idMessage1, BccList do
                if Count > 0 then EnviaEmail; //Send(idMessage1);

            end;

            Estado := 'Desconectando...';

          finally
            Disconnect;
            Screen.Cursor := crDefault;
          end;
          //ShowMessage('El Pedido fue enviado correctamente !!!');
        except
           // Capturo algunas excepciones que pueden ocurrir
          ON E: EIdProtocolReplyError do begin
            ShowMessage('No se ha podido enviar el email.' + #13 +
                'Incorrecto el email o el usuario o la password.' + #13 +
                E.Message + #13 + idMessage1.BccList.EMailAddresses);
          end;
          on E: EFOpenError do begin
            ShowMessage('No se ha podido enviar el email.' + #13 +
                'Fichero Adjunto desconocido o erróneo.');
          end;
          on E: EIdSocketError do begin
            ShowMessage('No se ha podido enviar el email.'+ #13 +
                'Host desconocido o incorrecto.');
          end
          else begin
            ShowMessage('Fallo en el envio de email');
          end;
        end;
        if connected then Disconnect;

      end;
__________________
Saludos

Javier
Responder Con Cita
 


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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Enviar mensaje (con fichero adjunto) a gmail Jose Manuel Ten Internet 2 31-07-2007 23:43:09
Enviar un email con un archivo adjunto Turboleta Internet 9 31-07-2006 19:55:16
Enviar adjunto por mail joel20 JAVA 3 10-07-2006 13:09:38
Enviar email con copia y adjunto con indy cmena Internet 4 01-10-2005 01:14:00
Enviar correo con dato adjunto jncrls Internet 1 06-05-2003 15:26:33


La franja horaria es GMT +2. Ahora son las 18:03:25.


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