apache-flex 从Android和iPhone上的Flex应用程序发送电子邮件

ghhkc1vu  于 2022-11-01  发布在  Apache
关注(0)|答案(1)|浏览(159)

使用flash builder我已经开发了一个应用程序的android和iPhone。我希望能够打开默认的电子邮件客户端的手机和发送一封电子邮件的附件。我已经看到了许多例子使用“mailto:“但这是不支持的附件。我已经谷歌了这一点广泛和没有发现任何是目前与在过去3年。
我已经做了PDF文件,我希望附加,可以移动到一个临时目录,如果需要,以满足访问问题。我想使用默认的邮件程序一样,其他程序使用,如果这是不可行的,请告诉我如何直接从应用程序发送电子邮件。

mf98qq94

mf98qq941#

仅供参考,以帮助扩展Action Script 3.0信息库。我无法找到任何方法来做我上面所要求的。下面是我用来发送带有附件的电子邮件的方法。https://code.google.com/p/airxmail/
http://flex.coltware.com/as3-flex-air/airxmail/

import com.coltware.airxmail.INetAddress;
import com.coltware.airxmail.MailSender.SMTPSender;
import com.coltware.airxmail.MimeMessage;
import com.coltware.airxmail.RecipientType;

private function send_plain_email():void{
//  How to send plain text email
var sender:SMTPSender = new SMTPSender();
sender.setParameter(SMTPSender.HOST,"your.smtp.hostname");
sender.setParameter(SMTPSender.PORT,25);  // default port is 25
// If you use SMTP-AUTH
sender.setParameter(SMTPSender.AUTH,true);
sender.setParameter(SMTPSender.USERNAME,"username");
sender.setParameter(SMTPSender.PASSWORD,"password");

// Create email message
var message:MimeMessage = new MimeMessage();

//  Set from email address and reciepients
var from:INetAddress = new INetAddress("from-email-address@xxxx.yyyy","from label");
message.setFrom(from);

var toRecpt:INetAddress = new INetAddress("to-email-address@xxxx.yyyy","to label");
message.addRcpt(RecipientType.TO,toRecpt);

var ccRecpt:INetAddress = new INetAddress("cc-email-address@xxxx.yyyy","cc label");
message.addRcpt(RecipientType.CC,ccRecpt);

//  
message.setSubject("hello world");
//
//  Plain Text Part
//
var textPart:MimeTextPart = new MimeTextPart();
message.setSubject("Reciept for #" + job.jobs.JobID);
textPart.contentType.setParameter("charset","UTF-8");
textPart.transferEncoding = "8bit";
textPart.setText("Please see attached PDF \n You will need a PDF viewer to open \n To download the latest version of Adobe Acrobat reader, Please follow the link: http://www.adobe.com/products/acrobat/readstep.html");
message.addChildPart(textPart);

//
//  Attachment part 
//
    var filePart:MimeImagePart = new MimeImagePart();
    filePart.contentType.setMainType("application");
    filePart.contentType.setSubType("pdf");
           filePart.setAttachementFile(File.desktopDirectory.resolvePath(sfile),"WorkOrder.pdf");
            message.addChildPart(filePart);

            sender.send(message);
            sender.close();
}

相关问题