Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 15-10-2007
jjoliveras jjoliveras is offline
Miembro
 
Registrado: ene 2004
Posts: 20
Poder: 0
jjoliveras Va por buen camino
Hola diegolf

no necesitas ningún controlador ActiveX, tan solo necesitas dos componentes que te vienen con las Indy, que son TIdSMTP y TIdMessage en las pestaña Indy Clients, e incluso puedes enviar ficheros adjuntos y autenticación en servidores.

Te dejo parte de mi código por si te sirviera de algo.

Código Delphi [-]
  
//configuramos el SMTP
  with SMTP do
    begin
      Host := 'mail.tuservidorsmtp.com';
      HeloName := Copy('tucuenta@correo.com', Pos('@', 'tucuenta@correo.com')+1,
        length('tucuenta@correo.com')-Pos('@', 'tucuenta@correo.com'));
      if lCor_Autentificar then
        begin
          AuthenticationType := atLogin;
          if (cCor_Aut_Usuario <> '') then UserName := cCor_Aut_Usuario
          else UserName := 'tucuenta@correo.com';
          if (cCor_Aut_Clave <> '') then Password := cCor_Aut_Clave
          else Password := 'tucontraseña';
        end
      else AuthenticationType := atNone;

      if nCor_Pue_Smtp <> 0 then Port := nCor_Pue_Smtp
      else Port := 25;
    end;

  //configuramos el correo
  with MailMessage do
    begin
      From.Address := 'tucuenta@correo.com';
      From.Name := 'tucuenta@correo.com';      
      Recipients.EMailAddresses := 'destinatario@correo.com';
      CharSet := 'iso-8859-1';

      Subject := teAsunto.Text;
      Body.Text := meMensaje.Lines.Text;
    end;

  // fichero adjunto
  if FileExists(teFichero.Text) then
    TIdAttachment.Create(MailMessage.MessageParts, teFichero.Text);

  //enviamos el correo
  try
    try
      SMTP.Connect(1000);
      SMTP.Send(MailMessage);
    except on E:Exception do
      StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
    end;
  finally
    if SMTP.Connected then SMTP.Disconnect;

  end;

Espero te sirva de referencia.

Saludos.
Responder Con Cita
 



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
mensaje rotativo lakers Varios 3 02-05-2007 12:32:00
Un mensaje en php Manuel PHP 0 10-11-2005 17:39:45
Mensaje bdertl60.bpl neleg Varios 5 04-04-2005 17:51:54
Mensaje de Yes/No Isaac Varios 4 11-02-2004 17:54:36


La franja horaria es GMT +2. Ahora son las 10:16:24.


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