Jump to content

Send an email confirmation message


azuredesign

Recommended Posts

I'm still new to PHP, so excuse my ignorance...

 

I am trying to get user's input on a form, send the form information to myself in an email, and then send the user and email to their inputted email address. This is the code I have, not sure what I'm doing wrong??!?!?

 

<?php 

$message = "Here is a Sign Change " . "\n\n"; 
$message = $message . "Submission Date and Time: " . date("l dS of F Y h:i:s A") . "\n"; 
$message = $message . "Customer Name: " . $_REQUEST['CustName'] . "\n"; 
$message = $message . "Contact Name: " . $_REQUEST['ContactName'] . "\n"; 
$message = $message . "Phone Number: " . $_REQUEST['Phone'] . "\n" . "\n"; 
$message = $message . "Email Address: " . $_REQUEST['EmailAddress'] . "\n" . "\n"; 
$message = $message . "Requested Change Date: " . $_REQUEST['ChangeDate'] . "\n" . "\n"; 
$message = $message . "Additional Comments: " . $_REQUEST['Comments'] . "\n" . "\n"; 
$message = $message . $_REQUEST['EmailSubmission']; 

// In case any of our lines are larger than 70 characters, we should use wordwrap() 
$message = wordwrap($message, 70); 

// Send to impact signs and insert headers and subject 
$email = "[email protected]"; 
$subject = "Here is a sign change email!"; 
$header = "From: WebEmail\r\n" 

// Compile info and send to submitter 
   mail($email,$subject,$message,$header); 

$message = "Thank you for submitting a form"; 
   $email = $_POST["EmailAddress"] 
   $subject = "Thank you for your submission"; 
   $header = "From: [email protected]\n" 
   
   // Compile info and send to submitter 
   mail($email,$subject,$message,$header); 

   // redirect back to url visitor came from 
   header('location:home.php'); 


?>ß

 

Link to comment
https://forums.phpfreaks.com/topic/79005-send-an-email-confirmation-message/
Share on other sites

<?php 
$message = "Here is a Sign Change " . "\n\n"; 
$message = $message . "Submission Date and Time: " . date("l dS of F Y h:i:s A") . "\n"; 
$message = $message . "Customer Name: " . $_REQUEST['CustName'] . "\n"; 
$message = $message . "Contact Name: " . $_REQUEST['ContactName'] . "\n"; 
$message = $message . "Phone Number: " . $_REQUEST['Phone'] . "\n" . "\n"; 
$message = $message . "Email Address: " . $_REQUEST['EmailAddress'] . "\n" . "\n"; 
$message = $message . "Requested Change Date: " . $_REQUEST['ChangeDate'] . "\n" . "\n"; 
$message = $message . "Additional Comments: " . $_REQUEST['Comments'] . "\n" . "\n"; 
$message = $message . $_REQUEST['EmailSubmission']; 

$message = wordwrap($message, 70); 
$email = "[email protected]"; 
$subject = "Here is a sign change email!"; 
$header = "From: WebEmail\r\n"; 
mail($email,$subject,$message,$header); 
$message = "Thank you for submitting a form"; 
$email = $_POST["EmailAddress"] ;
$subject = "Thank you for your submission"; 
$header = "From: [email protected]\n" ;
if(mail($email,$subject,$message,$header)){
header('location:home.php'); 
exit;
}
else{
echo 'failed';
}
?>

try.. no error message? maybe your error reporting is off... because actually i saw 4 errors in your script

try now

<?php 
$message = "Here is a Sign Change " . "\n\n"; 
$message = $message . "Submission Date and Time: " . date("l dS of F Y h:i:s A") . "\n"; 
$message = $message . "Customer Name: " . $_REQUEST['CustName'] . "\n"; 
$message = $message . "Contact Name: " . $_REQUEST['ContactName'] . "\n"; 
$message = $message . "Phone Number: " . $_REQUEST['Phone'] . "\n" . "\n"; 
$message = $message . "Email Address: " . $_REQUEST['EmailAddress'] . "\n" . "\n"; 
$message = $message . "Requested Change Date: " . $_REQUEST['ChangeDate'] . "\n" . "\n"; 
$message = $message . "Additional Comments: " . $_REQUEST['Comments'] . "\n" . "\n"; 
$message = $message . $_REQUEST['EmailSubmission']; 

$message = wordwrap($message, 70); 
$email = "[email protected]"; 
$subject = "Here is a sign change email!"; 
$header = "From: WebEmail\r\n"; 
mail($email,$subject,$message,$header); 
$message = "Thank you for submitting a form"; 
$email = $email ;
$subject = "Thank you for your submission"; 
$header = "From: [email protected]\n" ;
if(mail($email,$subject,$message,$header)){
header('location:home.php'); 
exit;
}
else{
echo 'failed';
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.