Skip to main content
Known Participant
April 29, 2012
Answered

How to get "Subject" & "Message" text from Flash form to default e-mail MS Outlook?

  • April 29, 2012
  • 1 reply
  • 1110 views

Hi,

I have the following code which is working fine except I can't get the user typed data from flash form to my default e-mail (MS Outlook) application. How to edit the following code?

In the code:

1) To  ---->  this field is okay since this email ID doesn't change

2) Cc  ---->  this filed is also okay since no changes will be in email ID

3) Subject  ----> this may not be always as "Feedback", user may like to change the subject

Whant I would like to add more here is:

1) From  ----> this text to be retrieved from "fromText.txt" input text box

2) Message  ----> this text to be retrieved from "MessageText.txt" input text box

//1.Button event listener
SendMail.addEventListener(MouseEvent.CLICK, SendEMail);

//2.The SendMail function open up email application to send email.

function SendEMail(event:MouseEvent):void {
var email:URLRequest = new URLRequest("mailto:administrator@helpdesk.com?CC=poweruser@helpdesk.com&Subject=Feedback");
navigateToURL(email, "_blank");
}

Thanks in advance for any support.

Regards.

This topic has been closed for replies.
Correct answer kglad

use:

var email:URLRequest = new URLRequest("mailto:administrator@helpdesk.com?CC=poweruser@helpdesk.com&Subject="+ subjectText.text+"&body=from: "+fromText.text+"\n\n"+MessageText.text);

1 reply

kglad
Community Expert
Community Expert
April 29, 2012

add a subjectText input textfield and use:

function SendEMail(event:MouseEvent):void {
var email:URLRequest = new URLRequest("mailto:administrator@helpdesk.com?CC=poweruser@helpdesk.com&Subject="+subjectText.txt+"?body=from: "+fromText.txt+"\n\n"+MessageText.txt);
navigateToURL(email, "_blank");
}

mdnavazAuthor
Known Participant
April 29, 2012

Thanks for the reply. I tried the code and result is like the following:

To: administrator@helpdesk.com

Cc: poweruser@helpdesk.com

Subject: [object TextField]?body=From: [object TextField]

Body: Blank

The problem exist in SUBJECT & BODY.

Further help, please.

Thanks.

PS: I removed the ? before body and put & ------> the result is as follows:

To: administrator@helpdesk.com

Cc: poweruser@helpdesk.com

Subject: [object TextField]

Body: From: [object TextField]

           [object TextField]

One more thing that it opens an empty web page with the following text in adress bar:

mailto:administrator@helpdesk.com?CC=poweruser@helpdesk&Subject=Feedback

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 29, 2012

use:

var email:URLRequest = new URLRequest("mailto:administrator@helpdesk.com?CC=poweruser@helpdesk.com&Subject="+ subjectText.text+"&body=from: "+fromText.text+"\n\n"+MessageText.text);