Jump to content

memorabeerlia

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About memorabeerlia

  • Rank
    Newbie
  1. First one is NOT received, but 2nd one is...Basically, the one going from "order" to "order" is never received. The only thing that I see error wise is what I pasted above...Nothing in SPAM folders
  2. OK. I have changed it up and now I am getting a different issue. Instead of the above code I am using phpMailer. For some reason, I am getting this error: 2014-12-12 03:46:21 2014-12-12 03:46:21 Connection: opened 2014-12-12 03:46:26 SERVER -> CLIENT: 2014-12-12 03:46:26 SMTP NOTICE: EOF caught while checking if connected 2014-12-12 03:46:26 Connection: closed 2014-12-12 03:46:26 SMTP connect() failed. Message could not be sent.Mailer Error: SMTP connect() failed Below is the code. I am getting an email to the email address the USER input, but I am not getting an email address to the static email address of "order@idrinktoremember.com." I appreciate the help. Thanks! <?php session_start();require 'phpmailer/PHPMailerAutoload.php';$mail = new PHPMailer;$mail->SMTPDebug = 3; // Enable verbose debug output$mail->isSMTP(); // Set mailer to use SMTP$mail->Host = 'smtp.idrinktoremember.com'; // Specify main server$mail->SMTPAuth = true; // Enable SMTP authentication$mail->Username = ''; // SMTP username$mail->Password = ''; // SMTP password$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted$mail->Port = 465; // TCP port to connect toif(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_subject = "We've Got an Order!"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['address']) || !isset($_POST['city']) || !isset($_POST['state']) || !isset($_POST['zip']) || !isset($_POST['opener']) || !isset($_POST['stain']) || !isset($_POST['memory']) || !isset($_POST['catcher'])) { died('We are sorry, but please ensure you filled in all required items. Click back to check.'); } include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { // the code was incorrect // you should handle the error so that the form processor doesn't continue // or you can use the following code if there is no validation or you do not know how echo "The security code entered was incorrect.<br /><br />"; echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again."; exit; } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // required $address = $_POST['address']; // required $city = $_POST['city']; // required $state = $_POST['state']; // required $zip = $_POST['zip']; // required $opener = $_POST['opener']; // required $stain = $_POST['stain']; // required $memory = $_POST['memory']; // required $catcher = $_POST['catcher']; // required $comments = $_POST['comments']; // not required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Order details below.<br><br>"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "<b>First Name:</b> ".clean_string($first_name)."<br>"; $email_message .= "<b>Last Name:</b> ".clean_string($last_name)."<br>"; $email_message .= "<b>Email: </b>".clean_string($email_from)."<br>"; $email_message .= "<b>Telephone: </b>".clean_string($telephone)."<br>";$email_message .= "<b>Address: </b>".clean_string($address)."<br>";$email_message .= "<b>City:</b> ".clean_string($city)."<br>";$email_message .= "<b>State:</b> ".clean_string($state)."<br>";$email_message .= "<b>Zip Code:</b> ".clean_string($zip)."<br>";$email_message .= "<b>Opener:</b> ".clean_string($opener)."<br>";$email_message .= "<b>Stain Selected:</b> ".clean_string($stain)."<br>";$email_message .= "<b>Memory Requested:</b>".clean_string($memory)."<br>";$email_message .= "<b>Catcher Requested:</b> ".clean_string($catcher)."<br>";$email_message .= "<b>Comments:</b> ".clean_string($comments)."<br>";$email_message .= "<p> - The MemoraBEERlia Team. <br>Drink to Remember!</p>"; //create email headers$mail->From = 'order@idrinktoremember.com';$mail->FromName = 'MemoraBEERlia';$mail->addAddress('order@idrinktoremember.com', 'Order Team'); // Add a recipient$mail->addReplyTo('order@idrinktoremember.com', 'Order Team');$mail->isHTML(true); // Set email format to HTML$mail->Subject = $email_subject;$mail->Body = $email_message;if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo;} else { echo '';}//send order confirmation email$email_subject_confirmation = "Congratulations, your order has been submitted!";$email_message_confirmation .= "The details of your order are below. Please review.<br><br>";$email_message_confirmation .= "<b>First Name: </b>".clean_string($first_name)."<br>"; $email_message_confirmation .= "<b>Last Name: </b>".clean_string($last_name)."<br>"; $email_message_confirmation .= "<b>Email: </b>".clean_string($email_from)."<br>"; $email_message_confirmation .= "<b>Telephone: </b>".clean_string($telephone)."<br>";$email_message_confirmation .= "<b>Address: </b>".clean_string($address)."<br>";$email_message_confirmation .= "<b>City: </b>".clean_string($city)."<br>";$email_message_confirmation .= "<b>State: </b>".clean_string($state)."<br>";$email_message_confirmation .= "<b>Zip Code: </b>".clean_string($zip)."<br>";$email_message_confirmation .= "<b>Opener Selected: </b>".clean_string($opener)."<br>";$email_message_confirmation .= "<b>Stain Selected: </b>".clean_string($stain)."<br>";$email_message_confirmation .= "<b>Memory Requested: </b>".clean_string($memory)."<br>";$email_message_confirmation .= "<b>Catcher Requested: </b>".clean_string($catcher)."<br>";$email_message_confirmation .= "<b>Comments: </b>".clean_string($comments)."<br>";$email_message_confirmation .= "<br><br>We will be contacting you shortly with a prototype of your design! Thank you!<br>";$email_message_confirmation .= "<br>- The MemoraBEERLia Team";$mail = new PHPMailer;$mail->From = 'order@idrinktoremember.com';$mail->FromName = 'MemoraBEERlia';$mail->addAddress($email_from); // Add a recipient$mail->addReplyTo('order@idrinktoremember.com', 'MemoraBEERlia Team');$mail->isHTML(true); // Set email format to HTML$mail->Subject = $email_subject_confirmation;$mail->Body = $email_message_confirmation;if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo;} else { echo '';}
  3. Hello, I created an order form on my website that takes the user's inputs, send confirmation emails to them and myself (order@), and then inserts the order into a mySQL database. The emails used to work, but now, for some reason, they never get sent. The email address it is supposed to be sending it to works and I have validated that nothing is getting blocked in SPAM, etc. The code for the email portion is below. I have tried debugging myself, but I get no errors on the mail() portion of the code. Any help that could be offered would be greatly appreciated. Thank you. if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "order@idrinktoremember.com"; $email_subject = "We've Got an Order!"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['address']) || !isset($_POST['city']) || !isset($_POST['state']) || !isset($_POST['zip']) || !isset($_POST['opener']) || !isset($_POST['stain']) || !isset($_POST['memory']) || !isset($_POST['catcher'])) { died('We are sorry, but please ensure you filled in all required items. Click back to check.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // required $address = $_POST['address']; // required $city = $_POST['city']; // required $state = $_POST['state']; // required $zip = $_POST['zip']; // required $opener = $_POST['opener']; // required $stain = $_POST['stain']; // required $memory = $_POST['memory']; // required $catcher = $_POST['catcher']; // required $comments = $_POST['comments']; // not required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Order details below.nn"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."n"; $email_message .= "Last Name: ".clean_string($last_name)."n"; $email_message .= "Email: ".clean_string($email_from)."n"; $email_message .= "Telephone: ".clean_string($telephone)."n";$email_message .= "Address: ".clean_string($address)."n";$email_message .= "City: ".clean_string($city)."n";$email_message .= "State: ".clean_string($state)."n";$email_message .= "Zip Code: ".clean_string($zip)."n";$email_message .= "Opener: ".clean_string($opener)."n";$email_message .= "Stain Selected: ".clean_string($stain)."n";$email_message .= "Memory Requested: ".clean_string($memory)."n";$email_message .= "Catcher Requested: ".clean_string($catcher)."n";$email_message .= "Comments: ".clean_string($comments)."n"; //create email headers $email_us = "order@idrinktoremember.com";$headers = "From: $email_us rn";$headers .= "Reply-To: $email_us rn";$headers .= "Return-Path: $email_usrn";$headers .= "X-Mailer: PHP rn";if(mail($email_to, $email_subject, $email_message, $headers)){ echo '';}else{ echo 'Error';}//send order confirmation email$email_subject_confirmation = "Congratulations, your order has been submitted!";$email_message_confirmation .= "The details of your order are below. Please review.nn";$email_message_confirmation .= "First Name: ".clean_string($first_name)."n"; $email_message_confirmation .= "Last Name: ".clean_string($last_name)."n"; $email_message_confirmation .= "Email: ".clean_string($email_from)."n"; $email_message_confirmation .= "Telephone: ".clean_string($telephone)."n";$email_message_confirmation .= "Address: ".clean_string($address)."n";$email_message_confirmation .= "City: ".clean_string($city)."n";$email_message_confirmation .= "State: ".clean_string($state)."n";$email_message_confirmation .= "Zip Code: ".clean_string($zip)."n";$email_message_confirmation .= "Opener Selected: ".clean_string($opener)."n";$email_message_confirmation .= "Stain Selected: ".clean_string($stain)."n";$email_message_confirmation .= "Memory Requested: ".clean_string($memory)."n";$email_message_confirmation .= "Catcher Requested: ".clean_string($catcher)."n";$email_message_confirmation .= "Comments: ".clean_string($comments)."n";$email_message_confirmation .= "nnWe will be contacting you shortly with a prototype of your design!n";$email_message_confirmation .= "nThe MemoraBEERLia Team";$headers = "From: $email_us rn";$headers .= "Reply-To: $email_us rn";$headers .= "Return-Path: $email_usrn";$headers .= "X-Mailer: PHP rn";if(mail($email_from, $email_subject_confirmation, $email_message_confirmation, $headers)){ echo '';}else{ echo 'Error';}
×
×
  • Create New...