martinjamesroberts Posted February 1, 2011 Share Posted February 1, 2011 I have the following php file, I need to send an email with an attachment when I call this script from flash, I've put below the actionscript I am using alongside.. can anyone help PLEASE ! Thanks in advance. <?PHP $to = 'myEmail addresss'; $subject = 'Validation'; $bound_text = "jimmyP123"; $bound = "--".$bound_text."\r\n"; $bound_last = "--".$bound_text."--\r\n"; $headers = "From: myEmailAddress\r\n"; $headers .= "MIME-Version: 1.0\r\n" ."Content-Type: multipart/mixed; boundary=\"$bound_text\""; $message .= "If you can see this MIME than your client doesn't accept MIME types!\r\n" .$bound; $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n" ."Et ben ! <b>regarde</b> un autre était créé\r\n" .$bound; $file = file_get_contents("snapshot1296548104559.jpg"); $message .= "Content-Type: image/jpg; name=\"snapshot1296548104559.jpg\"\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-disposition: attachment; file=\"snapshot1296548104559.jpg\"\r\n" ."\r\n" .chunk_split(base64_encode($file)) .$bound_last; if(mail($to, $subject, $message, $headers)) { echo 'MAIL SENT'; } else { echo 'MAIL FAILED'; } ?> Here is the actionscript :- var myLoader:URLLoader = new URLLoader(); var req:URLRequest = new URLRequest('sendMail.php'); myLoader.load(req); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.