I'm trying to send email android
no success
Synapse code that runs under Windows does not work on android
I tried the same with Indy 10 (indy-10.2.0.3.zip) work to windows a not work to android
exampl send lazarus windows>
uses
IdSMTP, IdMessage, IdSSLOpenSSL, IdExplicitTLSClientServerBase, IdIOHandler, IdAttachment;
procedure TForm1.Button2Click(Sender: TObject);
var IdSmtp :TIdSMTP;
IdMessage: TIdMessage;
begin
IdSmtp := TIdSMTP.Create(nil);
IdMessage:= TIdMessage.Create;
try
IdSMTP.Port := 587; //google port
IdSmtp.IOHandler := nil;
IdSmtp.ManagedIOHandler := true;
// try to use SSL
try
TIdSSLContext.Create.Free;
IdSmtp.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(idSmtp);
IdSmtp.UseTLS := utUseExplicitTLS;
except
IdSmtp.IOHandler.Free;
IdSmtp.IOHandler := nil;
end;
if (IdSmtp.IOHandler = nil) then
begin
IdSmtp.IOHandler := TIdIOHandler.MakeDefaultIOHandler(idSmtp);
IdSmtp.UseTLS := utNoTLSSupport;
end;
// send message, etc
IdSMTP.Host := 'smtp.gmail.com'; //host;
IdSMTP.Username := '__@gmail.com'; //username;
IdSMTP.Password := '******'; //password;
IdMessage.From.Address := '____@gmail.com'; //username;
IdMessage.Recipients.EMailAddresses := '_____@gmail.com';//from;
IdMessage.Subject := 'SUBJECT message'; //subject;
{if FileExists('c:\temp.txt') then
TIdAttachment.Create(IdMessage.MessageParts, 'c:\temp.txt');}
IdMessage.Body.Text := 'TekstPoruke';
IdSMTP.Connect();
IdSMTP.Send(IdMessage);
if IdSMTP.Connected then IdSMTP.Disconnect;
//----------------------
finally
idMessage.Free;
idSmtp.Free;
end;
end;