Jump to content


Photo

email attachment help


  • Please log in to reply
1 reply to this topic

#1 aladiyat23

aladiyat23
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • Locationflorida

Posted 24 July 2006 - 05:46 PM

I'm trying to send email with attachment from my php file. The message is delivered fine but I'm only getting the path to the file on the senders computer.

I've copied my php and the email body...

email body:
  From: carrie@x.net

  Dealer Name: asdf

  Address: asdf

  Zip: asdf

  Quanity: asdf

  List: Regular Auto

  Range:

  Year: asdf

  Make: asdf

  Other:

  D:\Program Files\XMPie\XMPie uImage\uImageOutput\DMMI

my php:

<?php
if ($_SERVER['REQUEST_METHOD']=="POST"){

  $to = "dmmisales@gmail.com";
  $subject = "Data Request";
  $email = $_POST['requiredemail'];
  $dname = $_POST['requireddealername'];
  $address = $_POST['requiredaddress'];
  $zip = $_POST['requiredzip'];
  $quanity = $_POST['requiredquanity'];
  $list = $_POST['requiredlist'];
  $range = $_POST['range'];
  $year = $_POST['year'];
  $make = $_POST['make'];
  $other = $_POST['other'];
 
  $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
 
  $tmp_name = $_FILES['uploadedfile']['tmp_name'];
  $type = $_FILES['uploadedfile']['type'];
  $name = $_FILES['uploadedfile']['name'];
  $size = $_FILES['uploadedfile']['size'];
 
  $message = "
  From: $email\n
  Dealer Name: $dname\n
  Address: $address\n
  Zip: $zip\n
  Quanity: $quanity\n
  List: $list\n
  Range: $range\n
  Year: $year\n
  Make: $make\n
  Other: $other\n";
 
  if (file_exists($tmp_name)){
  if(is_uploaded_file($tmp_name)){
  $file = fopen($tmp_name,'rb');
  $data = fread($file,filesize($tmp_name));
  fclose($file);
 
  $data = chunk_split(base64_encode($data));
}

  $headers = "From: $email\r\n" .
  "MIME-Version: 1.0\r\n" .
  "Content-Type: multipart/mixed;\r\n" .
  " boundary=\"{$mime_boundary}\"";

  $message = "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" .
  $message . "\n\n";

  $message .= "--{$mime_boundary}\n" .
  "Content-Type: {$type};\n" .
  " name=\"{$name}\"\n" .
  //"Content-Disposition: attachment;\n" .
  //" filename=\"{$fileatt_name}\"\n" .
  "Content-Transfer-Encoding: base64\n\n" .
  $data . "\n\n" .
  "--{$mime_boundary}--\n";

if (@mail($to, $subject, $message, $headers))
    echo '<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=http://www.dmmipromotions.com/submission.html">';
else
echo "An error has occured. Please fill out the form and try again";
  }
} else {
?>

Can anyone help me with this?

#2 aladiyat23

aladiyat23
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • Locationflorida

Posted 24 July 2006 - 07:20 PM

Maybe I should rephrase my question...

I'm trying to receive email with an attachment from a php form. I'm getting the message along with the senders path to their file they attempted to send.

Does anyone know of any known solutions or what part of the script would cause this?

Thanks :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users