Page 1 of 1

php email attachment

Posted: Thu May 15, 2008 3:42 pm
by bruckerrlb
Hi All, I am new to this site, and I am wondering if there is a way to send a php email with an attachment. I have the code to send an email from a php form, but I am looking to get it done with an attachment. I have checked out a bunch of sites, but don't understand exactly what they are doing, or what they are trying to do. This is the code that I currently have

Code: Select all

 
<?php
$description = $_POST['description'];
$requirements = $_POST['requirements'];
$location = $_POST['location'];
$salary = $_POST['salary'];
$priority = $_POST['priority'];
$agreement = $_POST['agreement'];
$screen1 = $_POST['screen1'];
$screen2 = $_POST['screen2'];
$screen3 = $_POST['screen3'];
$screen4 = $_POST['screen4'];
 
 
 
//Save visitor name and entered message into one variable:
$formcontent="Description: $description \n\n Requirements: $requirements \n\n Location: $location \n\n Salary: $salary \n\n Priority: $priority \n\n Agreement in Place: $agreement \n\n Screening question 1: $screen1 \n\n Screening question 2: $screen2 \n\n Screening question 3: $screen3 \n\n Screening question 4: $screen4";
$recipient = "me@me.com";
$subject = "Partner Submit";
$mailheader = "From: ME\r\n";
$mailheader .= "Reply-To: noreply\r\n";
$mailheader .= "MIME-Version: 1.0\r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Failure");
 
?>
 
So, I know I would have to have the upload form on the other page, where they fill out the form info, but where/how do I send it as an attachment. Also is there a way to send the attachment without having to store it on my server?

Re: php email attachment

Posted: Thu May 15, 2008 5:54 pm
by yacahuma