Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #12  
Antiguo 19-05-2016
elguille elguille is offline
Miembro
 
Registrado: ene 2005
Posts: 130
Poder: 22
elguille Va por buen camino
A mi el código me ha dejado de funcionar hace tres dias para clientes diferentes con cuentas diferentes ¿¿??¿
He encontrado este código en internet http://dejensever.com/2013/09/03/del...reos-por-smtp/ que me parece que de momento si funciona aunque no se que pasará día 1 de junio cuando quiten de forma definitiva sslv3.
Código Delphi [-]
function EnviarMensaje(sUsuario, sClave, sServidor, sAdjunto, sAsunto, sDestino, sMensaje: String; iPort: integer): String;
var
  SMTP: TIDSMTP;
  Mensaje: TIdMessage;
  adjunto: TIdAttachmentfile;
  IOHSOSSL: tIdSSLIOHandlerSocketOpenSSL;
begin
  IdSSLOpenSSLHeaders.Load;
  result := 'Mensaje enviado correctamente.';

  IOHSOSSL := tIdSSLIOHandlerSocketOpenSSL.Create;
  IOHSOSSL.Destination := sServidor + ':' + IntToStr(iPort);
  IOHSOSSL.host := sServidor;
  // IOHSOSSL.MaxLineAction := maException;
  IOHSOSSL.port := iPort;
  IOHSOSSL.ssloptions.method := sslvTLSv1;
  IOHSOSSL.ssloptions.VerifyMode := [];
  IOHSOSSL.ssloptions.VerifyDepth := 0;

  SMTP := TIDSMTP.Create(nil);
  SMTP.IOHandler := IOHSOSSL;
  SMTP.UserNAME := sUsuario;
  SMTP.password := sClave;
  SMTP.host := sServidor;
  SMTP.port := iPort;
  SMTP.UseTLS := utUseRequireTLS;

  Mensaje := TIdMessage.Create(nil);
  Mensaje.Clear;
  Mensaje.From.Name := sDestino;
  Mensaje.From.Address := sDestino;
  Mensaje.Subject := sAsunto;
  Mensaje.Body.Text := sMensaje;
  Mensaje.Recipients.Add;
  Mensaje.Recipients.Items[0].Address := sDestino;

  if sAdjunto <> '' then
  begin
    if FileExists(sAdjunto) then
      adjunto := TIdAttachmentfile.Create(Mensaje.MessageParts, sAdjunto);
  end
  else
    adjunto := nil;

  try
    SMTP.Connect;
  except
    result := 'Error al conectar con el servidor.';
  end;

  // Si ha conectado enviamos el mensaje y desconectamos
  if SMTP.Connected then
  begin
    try
      // SMTP.SendCmd('STARTTLS', 220);
      SMTP.Send(Mensaje);
    except
      result := 'Fallo en el envio de email';
    end;

    try
      SMTP.Disconnect;
    except
      result := 'Error al desconectar del servidor.';
    end;
  end;

  // Liberamos los objetos creados
  if adjunto <> nil then
    FreeAndNil(adjunto);

  FreeAndNil(Mensaje);
  FreeAndNil(SMTP);

end;
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
Error con NMSMTP a correo Hotmail acalderonr Internet 1 24-10-2014 11:55:27
[Compendio] Delphi 7 | Indy | Gmail | Outlook.com (ex Hotmail) MAXIUM Internet 4 20-02-2014 18:23:19
Problema con Indy en delphi 2010, enviando emails edtruji Internet 1 17-08-2010 18:17:31
Problemas y dudas enviando comandos al servidor FTP con Indy Gromeer Internet 8 01-02-2008 23:27:04
El correo que mando a una direccion de hotmail no llega bien URBANO Internet 1 27-04-2005 07:53:49


La franja horaria es GMT +2. Ahora son las 12:45:08.


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