Hi guys,
I have a PHP form which submits the result to me and also sends the $user a ‘thank you’ email, which works fine.
What I want to do is for the email that the $user is sent to have an attachment (probably PDF).
Does anyone know if this is possible and if so, how I could edit my code?
My code looks like:
<?php
$to = "me@mydomain.com";
$subject = "Form Submission";
$email=$_POST['email'] . "
";
$message = $headers;
$message .= "Name: " . $_POST["firstname"] . "
";
$message .= "Surname: " . $_POST["surname"] . "
";
$message .= "Company: " . $_POST["company"] . "
";
$message .= "Address: " . $_POST["address1"] . ", " . $_POST["address2"] . ", " . $_POST["address3"] . ", " . $_POST["postcode"] . "
";
$message .= "E-mail: " . $_POST["email"] . "
";
$message .= "E-mail Confirm: " . $_POST["email_confirm"] . "
";
$message .= "Telephone: " . $_POST["tel"] . "
";
$message .= "Spend: " . $_POST["aams"] . "
";
$message .= "Mailing List: " . $_REQUEST['mailinglist'] . "
";
$url = stripslashes($_POST["url"]);
if (!empty($url)) {
header( 'Location: http://www.google.com' );
exit();
}
mail($to, $subject, $message, $headers);
header( 'Location: http://www.mydomain.co.uk/sent.php' ) ;
$user = "$email";
$usersubject = "Thank you for registering";
$userheaders = "From: me@mydomain.com
";
$usermessage = "Dear " . $_POST["firstname"] . ",
Thank you for filling out my online form. Please see the attached document.
From me
www.mydomain.com
";
mail($user,$usersubject,$usermessage,$userheaders);
?>
Many thanks and I hope to hear from you.
SM