如何使使用AS3按钮发送电子邮件自动 [英] How to Make a button send an email using AS3 automatically

查看:239
本文介绍了如何使使用AS3按钮发送电子邮件自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在ActionScript 3.0和我做了一个网站!

在我的网站,我想使发送用按钮的点击电子邮件中的按钮,我不希望它打开他们的邮件客户端,而不是仅仅把它。

我目前使用的电子邮件地址功能,但想知道如何使自动发送邮件,或者我可以用什么来实现这一目标。

下面是我的code的一个片段:

 函数submitPoll(E:的MouseEvent):无效{

  //发送电子邮件的东西
  VAR要求:的URLRequest =新的URLRequest(电子邮件地址:name@hotmail.com+?主题=主题+&放大器;身体=世界,你好);
  navigateToURL(请求_blank);
  request.method = URLRequestMethod.POST;

  //其他

  Submit_btn.x = -100;

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

}
 

解决方案

与Flash的情况或多或少一样使用HTML的情况,当涉及到发送电子邮件。你有两个选择:

  1. 在弹出使用的mailto 因为你正在做的打开邮件客户端的用户的机器上。
  2. 发送 POST GET 请求到服务器,可以发送电子邮件代表你。

您想要做什么是数字2,这样意味着你需要一台服务器的访问能够发送邮件也可以接收 GET / POST 的请求。如果您有脚本访问到Web服务器,你完全可以找到一个免费的在线脚本,让您发送电子邮件。例如:

您如何将信息发送到该脚本将取决于变量的脚本要求你送。从动作你可能会想使用<一个href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLLoader.html">URLLoader:

 常量SCRIPT_URL:字符串=HTTP:// ....你的服务器... / ...脚本文件...;
VAR要求:的URLRequest =新的URLRequest(SCRIPT_URL);
VAR变量:使用URLVariables =新的URLVariables();

//这取决于脚本需要什么样的名字
variables.email =name@hotmail.com;
variables.subject =主题;
variables.body =Hello World的;

request.data =变量;

//取决于如果脚本使用POST或GET
//相应调整
request.method = URLRequestMethod.POST;

VAR的URLLoader:的URLLoader =新的URLLoader();
loader.load(要求);
 

I am working in actionscript 3.0 and am making a website!

In my website, I want to make a button that sends an email using a click of button and I don't want it to open their mail client, instead just send it.

I am currently using the "mailto" function but would like to know how to make it send automatically, or what else I can use to achieve that.

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;

}

解决方案

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:

  1. Pop open the email client on the users machine using mailto as you are doing.
  2. Send a POST or GET request to a server which can send the email on your behalf.

What you want to do is number 2 so that means you need access to a server capable of sending mail that can also receive GET/POST requests. If you have script access to your webserver you can undoubtedly find a free online script that will allow you to send emails. For example:

How you send the information to the script will depend on what variables the script requires you to send. From ActionScript you will probably want to use 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);

这篇关于如何使使用AS3按钮发送电子邮件自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆