Ver Mensaje Individual
  #1  
Antiguo 28-03-2016
D1360666 D1360666 is offline
Miembro
 
Registrado: mar 2008
Posts: 53
Reputación: 17
D1360666 Va por buen camino
Envio de correo por gmail

Hola gente como están??
Estoy haciendo un app con cliente de correo, el cual en el caso de usar una cuenta gmail, por razones de seguridad gmail, no me deja utilizar la cuenta desde mi app, en cambio probé utilizar una cuenta de Hotmail, y me anduvo barbaro.
Si alguno tiene idea de como solucionar el envío por gmail se agradece. Comparto el código que hice.

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
 DATA : TIdMessage;
 SMTP : TIdSMTP;
 SSL  : TIdSSLIOHandlerSocketOpenSSL;
begin
  SMTP := TIdSMTP.Create(nil);
  DATA := TIdMessage.Create(nil);
  SSL  := TIdSSLIOHandlerSocketOpenSSL.Create(nil);

  SSL.SSLOptions.Method := sslvTLSv1;
  SSL.SSLOptions.Mode   := sslmUnassigned;
  SSL.SSLOptions.VerifyMode := [];
  SSL.SSLOptions.VerifyDepth := 0;

  DATA.From.Address := '@gmail.com';
  DATA.Recipients.EMailAddresses := '@hotmail.com';
  DATA.Subject := 'hola';
  DATA.Body.Text := 'hola este es el cuerpo del mensaje';

  SMTP.IOHandler := SSL;
//  SMTP.Host := 'smtp.gmail.com';
//  SMTP.Host :='smtp-relay.gmail.com';
    SMTP.Host := 'smtp.live.com';
    SMTP.Port := 465;
//gmail  SMTP.Port := 587;
  SMTP.Username := '@hotmail.com';
  //SMTP.Password := '';
  SMTP.Password := '';
  SMTP.UseTLS := utUseExplicitTLS;

  SMTP.Connect;
  SMTP.Send(DATA);
  SMTP.Disconnect;

  SMTP.Free;
  DATA.Free;
  SSL.Free;

end;
Responder Con Cita