craigtolputt Posted August 18, 2008 Share Posted August 18, 2008 Hi Guys, I think this is possible but im not sure.... Can i have a flash form with an upload your photo button, then they browse for their photo and click send. Then the form data and photo are sent to an email address?? I have the form working fine i just need the code to add the image as an attachment. Anyone know any good tuts or have any info on this? this is my php mail sender... <?php $category = $_REQUEST["passenger1"]; $person = $_REQUEST["passenger2"]; $team = $_REQUEST["passenger3"]; $employer = $_REQUEST["passenger4"]; $yesno = $_REQUEST["passenger5"]; $nominator = $_REQUEST["passenger6"]; $jobtitle = $_REQUEST["passenger7"]; $address = $_REQUEST["passenger8"]; $postcode = $_REQUEST["passenger9"]; $phone = $_REQUEST["passenger10"]; $email = $_REQUEST["passenger11"]; $thedate = $_REQUEST["passenger12"]; $sign = $_REQUEST["passenger13"]; $nomineerole = $_REQUEST["passenger14"]; $achievements = $_REQUEST["passenger15"]; $why = $_REQUEST["passenger16"]; $evidence = $_REQUEST["passenger17"]; $subject = $_REQUEST["subject"]; // include sender IP in the message. $full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . "Cats 2008 Online Nomination Details" . "\n\n" . "Award Category: " . $category . "\n\n" . "Person/team being nomiated: " . $person . "\n\n" . "Nominee's job title/team name: " . $team . "\n\n" . "Employer (company/organisation): " . $employer . "\n\n" . "Does the nominee know they have been nominated: " . $yesno . "\n\n" . "Nominator's name: \n\n" . $nominator . "\n\n" . "Your job title: \n\n" . $jobtitle . "\n\n" . "Your contact address: \n\n" . $address . "\n\n" . "Postcode: " . $postcode . "\n\n" . "Your contact telephone: " . $phone . "\n\n" . "Your email: " . $email . "\n\n" . "Date: " . $thedate . "\n\n" . "Signature: " . $sign . "\n\n\n------------------------------------------------------------------------------------------------------\n\n\n" . "1. Describe fully the nominee’s role / current position and indicate the length of time the nominee has been employed. Please give general details if nomination is for a team:\n\n " . $nomineerole . "\n\n" . "2. Describe the nominee’s achievements over their period of employment, including both training / educational achievements, and any other relevant accomplishments or successes:\n\n " . $achievements . "\n\n" . "3. Explain WHY you believe the nominee should win this award, and HOW they meet the specified criteria?:\n\n " . $why . "\n\n" . "4. Please list any specific examples or evidence you have to support this nomination, e.g. • Letters from customers • Statements from work colleagues • Press cuttings • Certificates • Menus • Photographs:\n\n " . $evidence; $message= $full_message; // remove the backslashes that normally appears when entering " or ' $message = stripslashes($message); $subject = stripslashes($subject); $sender = stripslashes($sender); // send the email, make sure you replace [email protected] with your email address if(isset($message) and isset($subject) and isset($sender)){ mail("[email protected]", $subject, $message, "From: $email"); } ?> cheers Craig Link to comment https://forums.phpfreaks.com/topic/120171-solved-sending-an-email-with-an-attachment/ Share on other sites More sharing options...
JonnoTheDev Posted August 18, 2008 Share Posted August 18, 2008 You cannot include attachments using the mail() function. Use PEAR::Mail_Mime You will have to add these packages. Then you can use: $mail = new Mail_mime(); $mail->addAttachment("file.jpg", "text"); Link to comment https://forums.phpfreaks.com/topic/120171-solved-sending-an-email-with-an-attachment/#findComment-619100 Share on other sites More sharing options...
JonnoTheDev Posted August 18, 2008 Share Posted August 18, 2008 Package http://pear.php.net/package/Mail_Mime Link to comment https://forums.phpfreaks.com/topic/120171-solved-sending-an-email-with-an-attachment/#findComment-619101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.