Recent

Author Topic: TLazDeviceMessage email Android  (Read 5575 times)

zeljkoc

  • Full Member
  • ***
  • Posts: 145
    • Zeljko Cvijanovic
TLazDeviceMessage email Android
« on: October 05, 2012, 10:23:04 pm »
Please example send email TLazDeviceMessage for Android or link for help

Fortuna1

  • Full Member
  • ***
  • Posts: 164
Re: TLazDeviceMessage email Android
« Reply #1 on: October 06, 2012, 08:26:33 am »
I thing that in this case sysnapse the best solution.
http://www.lazarus.freepascal.org/index.php/topic,17663.msg97737.html#msg97737

or maybe  indy .
But I m not sure  that indy work good in android.

zeljkoc

  • Full Member
  • ***
  • Posts: 145
    • Zeljko Cvijanovic
Re: TLazDeviceMessage email Android
« Reply #2 on: November 14, 2012, 02:40:44 pm »
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>

Code: [Select]
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;
« Last Edit: November 14, 2012, 06:40:38 pm by zeljkoc »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: TLazDeviceMessage email Android
« Reply #3 on: November 15, 2012, 03:40:37 pm »
Hello, Sorry for the long delay, I only saw this now. TLazDeviceMessage contains already the structure preparing for future e-mail support, but it is not yet implemented for Android. Only SMS sending was implemented at the moment.

zeljkoc

  • Full Member
  • ***
  • Posts: 145
    • Zeljko Cvijanovic
Re: TLazDeviceMessage email Android
« Reply #4 on: November 15, 2012, 03:55:53 pm »
Thank felipemdc,

I'm trying to put together an application and need to send me an email when the expected implementation


I never used the Java
I try to translate  java:

Code: [Select]
  Intetn emailIntent = new Intent(android.content.Intent.ACTION_SEND);
  Intetn emailIntent = new Intent(android.Intent.action.SEND);
  string aEmailList[] = {"user@fakehost.com"};
  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
  emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Subject");
  emailIntent.setType("plain/text");
  emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My message body");
  startActivity(emailIntent);

 

TinyPortal © 2005-2018