I'm making a Flex AIR application that will produce a giftcard from a webcam picture. This giftcard needs to be sent in an e-mail to a recipient provided in the program. Should I upload the picture to a server and use php to send the mail?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You could try using SMTP Mailer, an ActionScript library for SMTP. It supports attachments, so it should meet your needs.
http://www.bytearray.org/?p=27
回答2:
var mailer:SMTPMailer = new SMTPMailer("localhost",25);
var myBitmap:BitmapData = new BitmapData(photo.width,photo.height);
myBitmap.draw(photo);
var myEncoder:JPEGEncoder = new JPEGEncoder(100);
var myCapStream:ByteArray = myEncoder.encode (myBitmap);
var subject:String = "subject goes here";
var content:String = "This is content";
mailer.sendAttachedMail ( "noreply@nobody", toEmail.text,subject, content, myCapStream, "style.jpg");
I used SMTPMailer 0.9 that is hosted in google code. 0.6 has a problem with image attachment.For email, "Test Mail Server Tool" is used to simulate the mail server.