Hi everyone,
Please i have a php script form that send attachement but i want it to also send an auto reply the users after filling out the form please can someone help me with the direction to do so, below is the php code for the form.. Thanks a million
PHP Code:
<?php
function mail_file($to, $from, $subject, $body, $file){
$boundary = md5(rand());
$headers = array(
'MIME-Version: 1.0',
"Content-Type: multipart/mixed; boundary=\"{$boundary}\"",
"From: {$from}"
);
$message = array(
"--{$boundary}",
'Content-Type: text/plain',
'Content-Transfer-Encoding: 7bits',
'',
chunk_split($body),
"--{$boundary}",
"Content-Type:{$file['type']}; name=\"{$file['name']}\"",
"Content-Disposition: attachment; filename=\"{$file['name']}\"",
"Content-Transfer-Encoding: base64",
'',
chunk_split(base64_encode(file_get_contents($file['tmp_name']))),
"--{$boundary}--"
);
mail($to, $subject, implode("\r\n", $message), implode("\r\n", $headers));
header('Location: contact-form-thank-you.html');
if (isset($_POST['firstname'], $_POST['lastname'], $_POST['company'], $_POST['address'], $_POST['phone'], $_POST['email'], $_POST['capacity'], $_FILES['file'])){
$body = <<<BODY
First Name: {$_POST['firstname']}
Last Name: {$_POST['lastname']}
Company Name: {$_POST['company']}
Address: {$_POST['address']}
Phone Number: {$_POST['phone']}
Email Address: {$_POST['email']}
Capacity: {$_POST['capacity']}
Details:
Name: {$_FILES['file']['name']}
Size: {$_FILES['file']['size']}
Type: {$_FILES['file']['type']}
BODY;
mail_file('sales@mydomain.com', 'sales@mydomain.com', 'AGENTS FORM', $body, $_FILES['file']);
}
?>
Bookmarks