PDA

View Full Version : AS3 send Email with attachment (swf printscreen->JPEG) capability?



watcher
January 4th, 2010, 01:46 PM
Hi Folks,

only those who actually got real code to show please.

Im looking for help on how to create send-email with attachment using AS3.

Furthermore the attachment should be printscreen of the flash movie converted into JPEG (preferrably with no need to upload the file to server - can this be done on the fly?), and the JPEG then should be included as attachment in the email.

Anyone who did this already and would be open to share?

-w


RELATED SOURCES:
(1) Only article ive found atm that describes generally how this can be done in AS3:
http://www.flashguru.co.uk/actionscript-3-new-capabilities

(2) this link seems to show how to get printscreen of [part of] flash movie and post it to server as jpeg:
http://designreviver.com/tutorials/actionscript-3-jpeg-encoder-revealed-saving-images-from-flash/

(3) printscreen swf and save to HDD as JPG/PNG [FP10]:
http://www.bit-101.com/blog/?p=1415

lorenzbiffa
January 27th, 2010, 09:54 PM
I have done it do you still need help?

watcher
March 15th, 2010, 10:33 AM
I have done it do you still need help?
not anymore, done it too :). thanks anyways

smuorfy
March 27th, 2010, 07:23 PM
I have done it do you still need help?

i could use some help how to send the bytearray image from flash to mail using php

gayandproud
July 14th, 2010, 02:47 PM
im looking for help on the very same thing. could you please share some basics to accomplis this mission?

would be so helpful.

thanks

bakajin
July 30th, 2010, 01:08 PM
Hi Folks,

only those who actually got real code to show please.

Im looking for help on how to create send-email with attachment using AS3.

Furthermore the attachment should be printscreen of the flash movie converted into JPEG (preferrably with no need to upload the file to server - can this be done on the fly?), and the JPEG then should be included as attachment in the email.

Anyone who did this already and would be open to share?

-w


RELATED SOURCES:
(1) Only article ive found atm that describes generally how this can be done in AS3:
http://www.flashguru.co.uk/actionscript-3-new-capabilities

(2) this link seems to show how to get printscreen of [part of] flash movie and post it to server as jpeg:
http://designreviver.com/tutorials/actionscript-3-jpeg-encoder-revealed-saving-images-from-flash/

(3) printscreen swf and save to HDD as JPG/PNG [FP10]:
http://www.bit-101.com/blog/?p=1415

That designreviver atricle is what i used to set it up in flash.
To send the email you have to clear this from his php script

// add headers for download dialog-box
header('Content-Type: image/jpeg');
header("Content-Disposition: attachment; filename=".$_GET['name']);


echo $jpg;
You the have to parse the bytearray from flash you sent.

$image64 = base64_encode($jpg);
$image = chunk_split($image64);

create a unique id num

$sep = sha1(date('r', time()));

get your email client & send yourself an email with an inline image
Copy the source into your php file

let php parse it and fill out the boundry id and message/content id with $sep

like

$header .= "Content-type: multipart/related; boundary=\"Boundary_(ID_".$sep.")\"\r\n";

$body = 'etc';
make sure you \r\n

and

mail( $to, $subject, $body, $header );

did the trick for me once i got those pesky headers right.

jollyjollyjolly
August 9th, 2010, 04:07 AM
I followed the directions as laid out...I think... with this code but it did not work. Ideas?


<?php

if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {

// get bytearray
$im = $GLOBALS["HTTP_RAW_POST_DATA"];

// add headers for download dialog-box
//header('Content-Type: image/jpeg'); // removed for testing
//header("Content-Disposition: attachment; filename=".$_GET['name']); //removed for testing
//echo $im; //removed for testing
echo $jpg
$image64 = base64_encode($jpg);
$image = chunk_split($image64);

$sep = sha1(date('r',time()));

$header .= "Content-type: multipart/related;
boundary=\"Boundary_(ID_".$sep.")\"\r\n";

$body = 'etc';

mail( $to, $subject, $body, $header );

} else echo 'An error occured.';

?>

zurito
September 20th, 2010, 04:53 PM
I followed the directions as laid out...I think... with this code but it did not work. Ideas?


<?php

if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {

// get bytearray
$im = $GLOBALS["HTTP_RAW_POST_DATA"];

// add headers for download dialog-box
//header('Content-Type: image/jpeg'); // removed for testing
//header("Content-Disposition: attachment; filename=".$_GET['name']); //removed for testing
//echo $im; //removed for testing
echo $jpg
$image64 = base64_encode($jpg);
$image = chunk_split($image64);

$sep = sha1(date('r',time()));

$header .= "Content-type: multipart/related;
boundary=\"Boundary_(ID_".$sep.")\"\r\n";

$body = 'etc';

mail( $to, $subject, $body, $header );

} else echo 'An error occured.';

?>

Did you ever get this resolved? If so I'd love to know what your solution was.