Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从Flash发送邮件(使用Actionscript 3.0)_Php_Actionscript 3_Email_Flash Cs5 - Fatal编程技术网

Php 从Flash发送邮件(使用Actionscript 3.0)

Php 从Flash发送邮件(使用Actionscript 3.0),php,actionscript-3,email,flash-cs5,Php,Actionscript 3,Email,Flash Cs5,我有一个flash项目,要添加的功能是,从flash.swf/.exe发送电子邮件而不重定向。只提供发件人的电子邮件id,点击后,表单应发送电子邮件。 为此,我在谷歌上搜索了很多,php解决方案已经给出,我无法处理它,可能是因为指导级别低。使用纯动作脚本,例如: ZIP中包含的库和FLA示例 实施示例: import org.smtp.mailer.SMTPMailer; import org.smtp.encoding.JPEGEncoder; import org.smtp.encoding

我有一个flash项目,要添加的功能是,从flash.swf/.exe发送电子邮件而不重定向。只提供发件人的电子邮件id,点击后,表单应发送电子邮件。 为此,我在谷歌上搜索了很多,php解决方案已经给出,我无法处理它,可能是因为指导级别低。

使用纯动作脚本,例如:

ZIP中包含的库和FLA示例

实施示例:

import org.smtp.mailer.SMTPMailer;
import org.smtp.encoding.JPEGEncoder;
import org.smtp.encoding.PNGEnc;
import org.smtp.events.SMTPEvent;
import flash.utils.ByteArray;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.*;

// create the socket connection to any SMTP socket
// use your ISP SMTP

var myMailer:SMTPMailer = new SMTPMailer (smtp_txt.text, 25);

// register events
// event dispatched when mail is successfully sent
myMailer.addEventListener(SMTPEvent.MAIL_SENT, onMailSent);
// event dispatched when mail could not be sent
myMailer.addEventListener(SMTPEvent.MAIL_ERROR, onMailError);
// event dispatched when SMTPMailer successfully connected to the SMTP server
myMailer.addEventListener(SMTPEvent.CONNECTED, onConnected);
// event dispatched when SMTP server disconnected the client for different reasons
myMailer.addEventListener(SMTPEvent.DISCONNECTED, onDisconnected);
// event dispatched when the client has authenticated successfully
myMailer.addEventListener(SMTPEvent.AUTHENTICATED, onAuthSuccess);
// event dispatched when the client could not authenticate
myMailer.addEventListener(SMTPEvent.BAD_SEQUENCE, onAuthFailed);

// take the snapshot
var myBitmap:BitmapData = new BitmapData ( stage.stageWidth, stage.stageHeight );

// encode as JPEG with quality 100
var myEncoder = new JPEGEncoder( 100 );

send_btn.addEventListener (MouseEvent.CLICK, onClick);

message_txt.text = "<img src='http://www.google.com/images/logo_sm.gif'</img><br><b>Picture file attached!</b>";

function onClick ( pEvt:MouseEvent )
{
    // replace this by any DisplayObject
    myBitmap.draw ( this );

    var myCapStream:ByteArray = myEncoder.encode ( myBitmap );

    // sends HTML email
    //myMailer.sendHTMLMail ( from_txt.text, to_txt.text, subject_txt.text, "<img src='http://www.google.com/images/logo_sm.gif'</img><br><b>Picture from HTML :)</b>");

    // send HTML email with picture file attached
    myMailer.sendAttachedMail ( from_txt.text, to_txt.text, subject_txt.text, message_txt.text, myCapStream, "image.jpg");
}

function onAuthFailed ( pEvt:SMTPEvent ):void
{
    status_txt.htmlText = "Authentication Error";
}

function onAuthSuccess ( pEvt:SMTPEvent ):void
{
    status_txt.htmlText = "Authentication OK !";
}

function onConnected ( pEvt:SMTPEvent ):void 
{
    status_txt.htmlText = "Connected : \n\n" + pEvt.result.message;
    status_txt.htmlText += "Code : \n\n" + pEvt.result.code;
}

function onMailSent ( pEvt:SMTPEvent ) 
{
    // when data available, read it
    status_txt.htmlText = "Mail sent :\n\n" + pEvt.result.message;
    status_txt.htmlText += "Code : \n\n" + pEvt.result.code;
}

function onMailError ( pEvt:SMTPEvent ):void 
{
    status_txt.htmlText = "Error :\n\n" + pEvt.result.message;
    status_txt.htmlText += "Code : \n\n" + pEvt.result.code;
}

function onDisconnected ( pEvt:SMTPEvent ):void 
{
    status_txt.htmlText = "User disconnected :\n\n" + pEvt.result.message;
    status_txt.htmlText += "Code : \n\n" + pEvt.result.code;
}

function socketErrorHandler ( pEvt:IOErrorEvent ) 
{
    // when data available, read it
    status_txt.htmlText = "Connection error !";
}

整洁的当然,这需要访问一个相当开放的SMTP服务器。大多数isp SMTP服务器不是基于IP限制使用吗?或者要求以其他方式进行身份验证吗?身份验证信息(如用户名/密码)不是您希望放在闪存文件中的内容?要点很好。SMTP服务器有一些免费选项,但我不知道条款/法律。我认为Rackspace提供SMTP服务,每月3美元。这些类支持SSL,但我不确定加密的优势是什么。