vettenut Posted November 26, 2011 Share Posted November 26, 2011 I do not receive email for my published php file which is: <?php ///// easend.php ///// $youremail = "[email protected]"; /*put the email address here, between quotes, the email address you want the message sent to*/ $to = $youremail; $email = $_POST['EMail']; $name2 = $_POST['Name']; $street2 = $_POST['Street']; $city2 = $_POST['City']; $state2 = $_POST['State']; $zip2 = $_POST['Zip']; $Phone = $_POST['Home_Phone']; $Cell = $_POST['Cell_Phone']; $education = $_POST['email1']; $comments = $_POST['email2'] ; $headers = "From:" . $email; $fields = array(); $fields{"Name"} = "Name"; $fields{"Street"} = "Street"; $fields{"City"} = "City"; $fields{"State"} = "State"; $fields{"Zip"} = "Zip"; $fields{"Home_Phone"} = "Home Phone"; $fields{"Cell_Phone"} = "Cell Phone"; $fields{"EMail"} = "Email"; $fields{"email1"} = "Education"; $fields{"email2"} = "Comments"; $subject = "We have received the following information from your employment application"; $body = "We have received the following information from your employment application:\n\n"; foreach($fields as $a => $b) { $body .= sprintf("%20s: %s\n",$b,$_POST[$a]); } mail ($to, $subject, $body, $headers); //send mail to owner #end create email vars $headers = "From:" . $to; mail ($email, $subject, $body, $headers); //send mail to user #end create email vars echo "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=ThankYou.html\"></head>"; ?> Link to comment https://forums.phpfreaks.com/topic/251850-php-problem/ Share on other sites More sharing options...
Laash Posted November 26, 2011 Share Posted November 26, 2011 Hi First of all, in PHP, you do arrays like this: $fields['Name']="$var or string"; Second, you need to send headers with your mail. Look here: http://www.w3schools.com/php/func_mail_mail.asp Link to comment https://forums.phpfreaks.com/topic/251850-php-problem/#findComment-1291375 Share on other sites More sharing options...
vettenut Posted November 26, 2011 Author Share Posted November 26, 2011 I am not experienced with php. Exactly what do I need to change and to what? Thank you. Link to comment https://forums.phpfreaks.com/topic/251850-php-problem/#findComment-1291379 Share on other sites More sharing options...
Pikachu2000 Posted November 26, 2011 Share Posted November 26, 2011 Hi First of all, in PHP, you do arrays like this: $fields['Name']="$var or string"; Second, you need to send headers with your mail. Look here: http://www.w3schools.com/php/func_mail_mail.asp Although I've never been able to find it documented in the manual, curly braces do seem to work to enclose array indices. Link to comment https://forums.phpfreaks.com/topic/251850-php-problem/#findComment-1291398 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.