PDA

Ver la Versión Completa : Enviar mail IOS Firemonkey


DamianG
15-08-2018, 18:22:45
Hola estoy tratando de enviar un mail desde IOS con Firemonkey y no logro hacerlo. Uso la siguiente rutina:


{$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, 20: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)?