Jump to content

Automated email help


axiom007

Recommended Posts

I am trying to send a automated email when a customer submits an online form.  The form allows them to add an attachment to the email.  I have used this script before and it worked fine. but now it will not work.  Maybe you guys can see the error in my ways.

 

<?PHP 
$to      = "rteague@axiomcore.com"; 
$from    = $_POST['email']; 
$subject = "Client Care Cards | New Account"; 

$fileatt      = $_FILES['clientupload']['tmp_name']; 
$fileatt_type = $_FILES['clientupload']['type']; 
$fileatt_name = $_FILES['clientupload']['name'];
$headers = "From: " .$from;
if (is_uploaded_file($fileatt)) { 
  $file = fopen($fileatt,'rb'); 
$data = fread($file,filesize($fileatt)); 
fclose($file);

$semi_rand = md5(time()); 
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 
  
$headers .= "\nMIME-Version: 1.0\n" . 
             "Content-Type: multipart/mixed;\n" . 
             " boundary=\"{$mime_boundary}\"";
$mess = "This is a multi-part message in MIME format.\n\n" . 
            "--{$mime_boundary}\n" . 
            "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . 
            "Content-Transfer-Encoding: 7bit\n\n" . 
            $mess . "\n\n";

$data = chunk_split(base64_encode($data));
}
$mess.= "Name: " . $_POST['name'] . "\n";
$mess.= "Company Name: " . $_POST['company'] . "\n";
$mess.= "Address: " . $_POST['address'] . "\n";
$mess.= "Best time to contact: " . $_POST['contacttime'] . "\n";
$mess.= "Office phone number: " . $_POST['officenumber'] . "\n";
$mess.= "Mobile number: " . $_POST['mobilenumber'] . "\n";
$mess.= "Fax number: " . $_POST['faxnumber'] . "\n";
$mess.= "Birthday: " . $_POST['bdaymonth'] . " " . $_POST['bdayday'] . "\n";
$mess.= "Contact person: " . $_POST['contact'] . "\n";
$mess.= "Business cards with mailings: " . $_POST['businesscards'] . "\n";
$mess.= "How did you hear about us?: " . $_POST['hearabout'] . "\n";
$mess.= "Return address (line 1): " . $_POST['rtline1'] . "\n";
$mess.= "Return address (line 2): " . $_POST['rtline2'] . "\n";
$mess.= "Return address (line 3): " . $_POST['rtline3'] . "\n";
$mess.= "Return address (line 4): " . $_POST['rtline4'] . "\n";
$mess.= "Programs: " . $_POST['circle'] . "\n";
$mess.= "          " . $_POST['realtor'] . "\n";
$mess.= "          " . $_POST['mortgage'] . "\n";
$mess.= "          " . $_POST['bday'] . "\n";
$mess.= "Personalization (line 1): " . $_POST['pline1'] . "\n";
$mess.= "Personalization (line 2): " . $_POST['pline2'] . "\n";
$mess.= "Personalization (line 3): " . $_POST['pline3'] . "\n";
$mess.= "Personalization (line 4): " . $_POST['pline4'] . "\n";
$mess.= "Jan: " . $_POST['jan'] . "\n";
$mess.= "Feb: " . $_POST['feb'] . "\n";
$mess.= "Mar: " . $_POST['mar'] . "\n";
$mess.= "Apr: " . $_POST['apr'] . "\n";
$mess.= "May: " . $_POST['may'] . "\n";
$mess.= "Jun: " . $_POST['jun'] . "\n";
$mess.= "Jul: " . $_POST['jul'] . "\n";
$mess.= "Aug: " . $_POST['aug'] . "\n";
$mess.= "Sep: " . $_POST['sep'] . "\n";
$mess.= "Oct: " . $_POST['oct'] . "\n";
$mess.= "Nov: " . $_POST['nov'] . "\n";
$mess.= "Dec: " . $_POST['dec'] . "\n";
$mess.= "Cardholder name: " . $_POST['cardholder'] . "\n";
$mess.= "Billing address: " . $_POST['billingaddress'] . "\n";
$mess.= "Card type: " . $_POST['cardtype'] . "\n";
$mess.= "Expiration Date: " . $_POST['expmonth'] . "/" . $_POST['expyear'] . "\n";
$mess.= "--{$mime_boundary}\n" . 
             "Content-Type: {$fileatt_type};\n" . 
             " name=\"{$fileatt_name}\"\n" . 
             "Content-Disposition: attachment;\n" . 
             " filename=\"{$fileatt_name}\"\n" . 
             "Content-Transfer-Encoding: base64\n\n" . 
             $data . "\n\n" . 
             "--{$mime_boundary}--\n";
$sendmail = mail($to, $subject, $mess, $headers);

 

any help will be appreciated! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.