Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Desarrollo en Delphi para iOS/OSX (https://www.clubdelphi.com/foros/forumdisplay.php?f=56)
-   -   Enviar mail IOS Firemonkey (https://www.clubdelphi.com/foros/showthread.php?t=93352)

DamianG 15-08-2018 19:22:45

Enviar mail IOS Firemonkey
 
Hola estoy tratando de enviar un mail desde IOS con Firemonkey y no logro hacerlo. Uso la siguiente rutina:


Código:

{$IFDEF IOS}
  var NSU: NSUrl;
      lURLnew:string;
  begin

  lURLnew := url;

  if (xSubject<>'') or (xbody<>'') then
  begin


    lURLnew := lURLnew+'?subject='+xSubject;

    if xbody<>'' then
      lURLnew := lURLnew+'&body='+ xbody;

    lURLnew := StringReplace(lURLnew,' ','%20',[rfReplaceAll]); //replace spaces
    lURLnew := StringReplace(lURLnew,sLineBreak,'%0D%0A',[rfReplaceAll]);//replace linebreaks
  end;

  NSU := StrToNSUrl(TIdURI.URLEncode(lURLnew));
  if SharedApplication.canOpenURL(NSU) then
    exit(SharedApplication.openUrl(NSU))
  else
  begin
    if DisplayError then
      ShowMessage('Error: Opening "' + URL + '" not supported.');           
    exit(false);
  end;
  end;
{$ELSE}
  begin
    raise Exception.Create('Not supported!');
  end;
{$ENDIF IOS}


Pero al ejecutarlo me da el siguiente error:


"Protocol field is empty"


Tendran la forma de hacerlo correctamente?



Gracias

dec 15-08-2018 21:44:48

Hola a todos,

Probablemente, no te ayude, pero, basándome en el mensaje de error,... ¿has comprobado que la URL en cuestión comienza por "mailto://" (sin las comillas)?


La franja horaria es GMT +2. Ahora son las 14:50:16.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi