Results 1 to 1 of 1

Thread: Issue sending mail with both file and text

  1. #1
    Join Date
    Jan 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Issue sending mail with both file and text

    I am having a problem taking both information from a form along with a file. I can either receive an email with a file or a email with the form entries. My text is this:
    PHP Code:
    <?php
     $to
    '_@gmail.com';
     
    $subject'Application';
     
    $from'Website';
     
    $fname $_POST['fname'] ;
     
    $lname $_POST['lname'] ;
     
    $phone $_POST['phone'] ;
     
    $email $_POST['email'] ;
     
    $state $_POST['state'] ;
     
    $city $_POST['city'] ;
     
    $about $_POST['about'] ;
     
    $experience $_POST['experience'] ;
      
     
    $fileatt      $_FILES['fileatt']['tmp_name'];     
     
    $fileatt_type $_FILES['fileatt']['type'];     
     
    $fileatt_name $_FILES['fileatt']['name'];
     
    $headers "From: $fname";
     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}\"";
     
    $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";
     
    $data chunk_split(base64_encode($data));
     
    $message .= "--{$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";     
    }

     
    $bodystripslashes ('fname ' $fname ' lname ' $lname ' phone ' $phone ' email ' $email ' state ' $state ' city ' $city '  about ' $about ' experience ' $experience $from) ;
      
     
    $okmail$to$subject$message$headers$body);
      if (
    $ok) {     
     echo 
    "<p>Form temporarily unavaliable</p>";     
    } else {     
     echo 
    "<p>Mail could not be sent. Sorry!</p>";     
    }     

    ?><title>sendmail.php</title>
    I would prefer to send multiple files as well! I have been working on this way to long lol and would really appreciate everyones input. I am assuming it is something simple that I keep looking over. Just to clarify I am receiving email and it has an attached file. I am just not receiving the "$body" portion which is essential as well. Thanks ahead of time!
    Last edited by weiner769; 02-14-2010 at 11:54 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •