Thanks for your replies. Yes I would like to email them a file. I managed for it to work with this code
<?
$name = $REQUEST['name'] ;
$address = $REQUEST['address'] ;
$city = $REQUEST['city'] ;
$state = $REQUEST['state'] ;
$zip = $REQUEST['zip'] ;
$phone = $REQUEST['phone'] ;
$email = $_REQUEST['email'] ;
if (!isset($_REQUEST['address'])) {
header( "Location: http://html" );
}
elseif (empty($name) || empty($address) || empty($phone) || empty($email))
echo "Please fill out all fields." ;
else {
mail( "myemail@email.com", "File requested for $name",
"Name: $name
Address: $address $city, $state $zip
Phone: $phone
Email: $email ",
"From: $email" );
header( "Location: thankyou.html" );
}
?>
<?php
$to = "$name <$email>";
$from = "my email <myemail@email.com>";
$subject = "File requested for for $name";
$message ="
Dear $name!
Here is the file you requested
";
$fileatt = "file.pdf";
$fileatttype = "application/pdf";
$fileattname = "file.pdf";
$headers = "From: $from";
?>
<?php
$file = fopen( $fileatt, 'rb' );
$data = fread( $file, filesize( $fileatt ) );
fclose( $file );
?>
<?php
$file = fopen( $fileatt, 'rb' );
$data = fread( $file, filesize( $fileatt ) );
fclose( $file );
?>
<?php
$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: {$fileatttype};\n" .
" name=\"{$fileattname}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileattname}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
?>
<?php
if( mail( $to, $subject, $message, $headers ) ) {
echo "<p>The email was sent.</p>";
}
else {
echo "<p>There was an error sending the mail.</p>";
}
?>
I figured that this part is where I enter the file information. Now how do I change it so that it will send multiple files?
$fileatt = "file.pdf";
$fileatttype = "application/pdf";
$fileattname = "file.pdf";