Tema: Mensaje SMS
Ver Mensaje Individual
  #2  
Antiguo 15-10-2007
jjoliveras jjoliveras is offline
Miembro
 
Registrado: ene 2004
Posts: 20
Reputación: 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('[email protected]', Pos('@', '[email protected]')+1,
        length('[email protected]')-Pos('@', '[email protected]'));
      if lCor_Autentificar then
        begin
          AuthenticationType := atLogin;
          if (cCor_Aut_Usuario <> '') then UserName := cCor_Aut_Usuario
          else UserName := '[email protected]';
          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 := '[email protected]';
      From.Name := '[email protected]';      
      Recipients.EMailAddresses := '[email protected]';
      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