RON_ron Posted August 14, 2009 Share Posted August 14, 2009 I've got a sumbit form in flash. If I send few images to the PHP server side script how can I receive them in my mail as an attachment? I'm NOT GOOD at PHP so I need help in the PHP script? Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/ Share on other sites More sharing options...
RON_ron Posted August 16, 2009 Author Share Posted August 16, 2009 Isn't that possible? Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899316 Share on other sites More sharing options...
Garethp Posted August 16, 2009 Share Posted August 16, 2009 http://www.theukwebdesigncompany.com/articles/php-file-attachments.php Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899317 Share on other sites More sharing options...
RON_ron Posted August 16, 2009 Author Share Posted August 16, 2009 I guees you've answered my question. BRILLIENT!!! Thanks a million! Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899326 Share on other sites More sharing options...
RON_ron Posted August 16, 2009 Author Share Posted August 16, 2009 What am I doing wrong here? or is it perfect?? <?PHP $to = "mymail@abc.com"; $subject = "$subject"; $headers = "From:" .$email."\r\n"; $headers .= "Bcc: $email\r\n"; $message = "Name: " . $thename; $file_array = array(0=>array('file'=>'http://webpath/Kline.jpg', 'mimetype'=>'image/jpeg', 'filename'=>'Kline.jpg')); $sentOk = mail("$to",$subject,$message,$headers); echo $_POST["message"]; echo "sentOk=" . $sentOk; Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899338 Share on other sites More sharing options...
DarkendSoul Posted August 16, 2009 Share Posted August 16, 2009 Personally I think that mail can be such a finicky thing you should let an API handle it. Personally I use PhpMailer: http://phpmailer.worxware.com/index.php?pg=phpmailer For attachments its quiet simple. <?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->AddAddress("whoever@whatever.com", "John Doe"); $mail->From = "from@example.com"; $mail->AddAddress("myfriend@example.net"); $mail->Subject = "First PHPMailer Message"; $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer."; $mail->AddAttachment("images/phpmailer.gif"); if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899341 Share on other sites More sharing options...
RON_ron Posted August 16, 2009 Author Share Posted August 16, 2009 My submit form is in FLASH. I'm using this PHP to catch the data + the images (as attachments) in to my mail. Data capturing works pretty well. So I tried adding only the line AddAttachemnt. But there's some error in it. What's wrong here? I need the images tobe as attachemnts. Current code <?PHP $to = "mamail@mail.com"; $subject = "subject"; $headers = "From:" .$email."\r\n"; $headers .= "Bcc: $email\r\n"; AddAttachment("images/Kline.jpg"); $message = "Name: " . $thename; echo "sentOk=" . $sentOk; Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899351 Share on other sites More sharing options...
RON_ron Posted August 16, 2009 Author Share Posted August 16, 2009 Well... could anyone give me a solution. I just need the CODE to insert (Receive image in the server as an email ATTACHMENT). Ron. Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899427 Share on other sites More sharing options...
RON_ron Posted August 17, 2009 Author Share Posted August 17, 2009 WOW! is my question so hard to answer I'm just expecting an answer like (infact it's not the correct one, just a sample): $uploaddir = 'images_dir/'; $dir = opendir($uploaddir); $files = array(); Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899952 Share on other sites More sharing options...
DarkendSoul Posted August 17, 2009 Share Posted August 17, 2009 AddAttachment is part of the PHPMailer Class, you need to include the PHPMailer class in order to use the function. You have plenty of resources in front of you and code to use them... I don't know what else to give you. Quote Link to comment https://forums.phpfreaks.com/topic/170241-script-to-receive-images-as-attachments/#findComment-899957 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.