Link to home
Start Free TrialLog in
Avatar of everettmarshall
everettmarshall

asked on

How Do I Use a Flash Button to Open an Email Client and Pre-fill Subject and Body?

My Flash (AS3) project needs to be able to open and send email from the user's client.  (We do not want to have a Flash form email as it could get abused.)

Subject and Body are preset by our system, not the user.  (Obviously, they could be edited.)

How can I make this work?

Avatar of Zeffer
Zeffer
Flag of New Zealand image

try this..

on (release) {
      getURL("mailTo:someone@everettmarshall.com?subject=The subject&body=Some text here" );
}

Z
Avatar of everettmarshall
everettmarshall

ASKER

on (release) {
      getURL("mailTo:someone@everettmarshall.com?subject=The subject&body=Some text here" );
}

That doesn't seem to work in AS3...but this kinda' does:

 function gotoURL1(event:MouseEvent) {
   var url = new URLRequest('mailTo:someone@everettmarshall.com?subject=The subject&body=Some text here');
   navigateToURL(url, '_blank');
 }

 s2f_btn.addEventListener(MouseEvent.CLICK, gotoURL1);


It opens the email client and fills Subject and Body.  I could live with this except any punctuation in the subject or body text (apostrophe) breaks the script.  Is there any way to allow the body to contain html?
Yes there is.
Z
ASKER CERTIFIED SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This has become harder than I thought, so I'm increasing point value to 500 as I need a solution pretty quick.

The issue I'm facing occurs before ever getting out of Flash.  Entering the text I want to have populate the email body causes a break in AS3 code. Using html punctuation equivalent doesn't work.  How do I format the text I want to attempt to pass to the email client?

I'm not convinced that the existing code I have is correct, only that it has partial functionality.

What is the best way to accomplish what I am attempting?  (A button that opens the default email client and pre-fills Subject and Body.)

 
incidentally that code I gave you in the first post.. the swf needs to be in an html page to work..your code would work straight from the swf
also
I am now unsure that you can format the text going into the body..( I thought one could) I have searched extensively and nowhere (that I can find) is there a way to format the text with html.
I have looked at at least a dozen different sites on using mailTo and not one has any formatting of the text.. you might have to stick with plain text :(

Z