Ver Mensaje Individual
  #5  
Antiguo 04-08-2014
Efren2006 Efren2006 is offline
Miembro
 
Registrado: feb 2006
Posts: 172
Reputación: 19
Efren2006 Va por buen camino
Adjunto Mi Programa:

Código Delphi [-]
procedure TDataImpresion.EnvioCorreo(Sender: TObject);
Var
  ArcAdjunto,NomArchivo:string;
  Adjunto:TIdAttachmentFile;
begin
   with SMTP do
   begin
     AuthType := satDefault;
     Port := StrToInt(BioPuerto.Text);
     Host := BioHost.Text;
     Username := BioNomUsuario.Text;
     Password := BioNomClave.Text;
     UseTLS := utUseImplicitTLS;
     IOHandler:=Socket;
   end;
   with Socket do
   begin
     DefaultPort:=0;
     Host:=BioHost.Text;
     Destination:=BioHost.Text+':'+BioPuerto.Text;
     Port:=StrToInt(BioPuerto.Text);
     SSLOptions.Method:=sslvSSLv3;
     SSLOptions.Mode:=sslmUnassigned;
     SSLOptions.VerifyDepth:=0;
   end;
   Mensaje.Clear;
   with Mensaje do
   begin
     Recipients.Clear;
     Recipients.Add;
     Recipients[0].Name := 'EFREN AGUILAR';
     Recipients[0].Address := BioPara.Text;
     From.Name := Global.Cia.Nombre;
     From.Address := BioNomUsuario.Text;
     Subject := BioAsunto.Text;
     Body.Clear;
     Body.Text :=BioTexto.Lines.Text;
     IsEncoded :=False;
     ContentType := 'multipart/mixed';
     MessageParts.Clear;
     Priority := mpHighest;
   end;
   // adjuntamos el archivo
   ArcAdjunto:=ArchivoAdjunto;
   if (ArcAdjunto<>'') and (FileExists(ArcAdjunto)) then
      begin
      NomArchivo:=ExtractFileName(ArcAdjunto);
      Adjunto:=TIdAttachmentFile.Create(Mensaje.MessageParts, ArcAdjunto);
      Adjunto.ContentType:='application/pdf';
      Adjunto. FileName:=NomArchivo;
      Adjunto.ContentID:=NomArchivo;
      Adjunto.DisplayName:=NomArchivo;
      end
    else
      begin
      Adjunto := nil;
      end;
   try
     Smtp.Connect;
     try
        smtp.Send(Mensaje);
        ShowMessage('El Correo Fue Enviado Satisfactoriamente...');
     except
        on E: Exception do ShowMessage(E.Message);
     end;
   finally
     if smtp.Connected then
        smtp.Disconnect;
     if Adjunto <> nil then
        FreeAndNil( Adjunto );
   end;
end;
Responder Con Cita