How to make the send email button using AS3 automatically

I work in ActionScript 3.0 and make a website!

On my website, I want to create a button that will send an email with the click of a button, and I do not want it to open its email client, but simply send it.

I am currently using the mailto function, but I want to know how to send it automatically, or what else I can use to achieve this.

Here is a snippet of my code:

function submitPoll(e:MouseEvent):void {

  //sending the email stuff
  var request:URLRequest = new URLRequest("mailto:name@hotmail.com"+"?subject=Subject"+"&body= Hello world ");
  navigateToURL(request, "_blank"); 
  request.method = URLRequestMethod.POST;

  //other

  Submit_btn.x = -100;

  pollUsed = true;
  thanks_txt.x = 849;
  thanks_txt.y = 656;

}
+3
source share
2 answers

The situation with Flash is more or less the same as the situation with HTML when it comes to sending email. You have 2 options:

  • , mailto, .
  • POST GET , .

, , 2, , , , GET/POST. script -, script, . :

script, , script. ActionScript , , URLLoader:

const SCRIPT_URL:String = "http:// .... your server ... / ... script file ...";
var request:URLRequest = new URLRequest(SCRIPT_URL);
var variables:URLVariables = new URLVariables();

// these depend on what names the script expects
variables.email = "name@hotmail.com";
variables.subject = "Subject";
variables.body = "Hello World";

request.data = variables;

// depends if the script uses POST or GET
// adjust accordingly
request.method = URLRequestMethod.POST;

var urlLoader:URLLoader = new URLLoader();
loader.load(request);
+7

, URLRequest PHP. PHP .

, , , . , ... :

+1

Source: https://habr.com/ru/post/1716638/


All Articles