views:

1281

answers:

3

I'm making e Flex AIR application that will produce a giftcard from a webcampicture. This giftcard needs to be sended 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?

+4  A: 

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

cliff.meyers
nice, thanks man! this thing is awesome, working really good :)
Joachim
Sweet, I'm glad it works!
cliff.meyers
A: 

Guys, I can't seem to make it work with the SMTPMailer library... It neither sends the email nor gives me an error message. Can anyone please help me? I've been trying to send the email using gmail. Thanks.

anagabrielle
You should delete this answer and create a new question.
cliff.meyers
+1  A: 
        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.

zawhtut