Search code examples
actionscript-3mailto

AS3 : cannot fill subject and body in mailto


I am currently programming using as3 and I want to fill subject and body of my mail using mailto.

I tried everything I've seen on Internet but nothing worked :(

This is my entire code:

import flash.display.Sprite; 
import flash.net.URLRequest;
import flash.net.navigateToURL;

function openMailClient(event:MouseEvent):void
{
   var mail:URLRequest = new URLRequest("mailto:hi@hi.com?subject=hi&body=hi");
   navigateToURL(mail);
}
stage.addEventListener(MouseEvent.CLICK, openMailClient);

Can someone help me?


Solution

  • Based on the comments provided, if your goal is to send an email you should do it in another and better way...

    For example you could create a webservice (php script, java service, or other technology dedicated to sending the email, expose an URL which after receiving subject,body, etc will send the mail...)

    Regarding your problem with outlook I only found this other Answer that can help you...

    mailto: subject= and body= support in email clients

    The behavior depends on the browser, OS, and other external factor... The ?subject...&body syntax is not standard and any browser/application treats it in a different way...