Adding an inline image into an AS3 created email
I get the error:
SecurityError: Error #3769: Security sandbox violation: Only simple headers can be used with navigateToUrl() or sendToUrl().
with the code below. I just want the users email system to open and create a new email but have a jpg image inserted inline (not attached). Something like:
Hello welcome to....
image here
Thanks for visiting...
Maybe since "image/jpeg" doesn't work as a content, is there a workaround? The only other option is to copy the image to the clipboard and have the user paste it into the email. Other than that, I'm at a loss as what to do.
I cannot go the typical route of sending the image to a server and having it send out the email. I already have that working but do to the new security laws in the UK, I need this simpler option using the users personal email.
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import com.adobe.images.JPGEncoder;
var bd:BitmapData = new BitmapData( 100, 100, false, 0x222222 );
var jpg:JPGEncoder = new JPGEncoder(50);
var ba:ByteArray = jpg.encode(bd);
emailButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void {
var header:URLRequestHeader = new URLRequestHeader("Content-type", "image/jpeg");
var request:URLRequest = new URLRequest("mailto:email?subject="+encodeURIComponent("Hello")+"&body="+encodeURIComponent("asdf"));
request.requestHeaders.push(header);
request.method = URLRequestMethod.POST;
request.data = ba;
navigateToURL(request," _blank");
}
