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 = "joewiebe@gmail.com"; 
$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: impact_signs@mts.net\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
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 = "joewiebe@gmail.com"; 
$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: impact_signs@mts.net\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

Link to comment
Share on other sites

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 = "joewiebe@gmail.com"; 
$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: impact_signs@mts.net\n" ;
if(mail($email,$subject,$message,$header)){
header('location:home.php'); 
exit;
}
else{
echo 'failed';
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.