yukafluck Posted March 28, 2009 Share Posted March 28, 2009 I have a form on one page and when the visitor hits submit, it goes to a sendmail.php, only problem is that it send two emails, one with all the variables, and one with the variables empty, any help would be awesome <?php $cus_email = $_POST['cus_email'] ; $lead_message = $_POST['lead_message'] ; $home_number = $_POST['home_number'] ; $cus_name = $_POST['cus_name']; $cell_number = $_POST['cell_number']; $cus_name = $_POST['cus_name']; $date = $_POST['date']; $info_type = $_POST['info_type']; print "Congratulations your email has been sent "; // Include the Mail and Mime_Mail Packages include('Mail.php'); include('Mail/mime.php'); // Recipient Name and E-mail Address $name = $first_name; $recipient = "[email protected]"; // Sender Address $from = $cus_email; // Message Subject $subject = " $cus_name would like more information about financing a $info_type"; // E-mail Body $html = <<<html <html><body> <h3>Important Email Lead for You!</h3> <p> Hello<br /> <p> On $date, $cus_name looked at your finance page and is trying to get financed for a $info_type <p>Their Home Number is: $home_number</p> <p>Their Cell Number is: $cell_number</p> <p>Their email is: $cus_email</p> </p> <p>Additional comments.</p> <p>$lead_message</p> <p> <p>They want to talk with you.</p> <p> Call them now!!! Jackass!!! html; // Identify the Relevant Mail Headers $headers['From'] = $from; $headers['Subject'] = $subject; // Instantiate Mail_mime Class $mimemail = new Mail_mime(); // Set HTML Message $mimemail->setHTMLBody($html); // Build Message $message = $mimemail->get(); // Prepare the Headers $mailheaders = $mimemail->headers($headers); // Create New Instance of Mail Class $email =& Mail::factory('mail'); // Send the E-mail Already! $email->send($recipient, $mailheaders, $message) or die("Can't send message!"); ?> Link to comment https://forums.phpfreaks.com/topic/151521-sendmailphp-sends-two-emails/ Share on other sites More sharing options...
MadTechie Posted March 28, 2009 Share Posted March 28, 2009 Really need to see how its being called but as a gues try <?php if(!isset($_POST['cus_name'])) exit(); //....reset of your code Link to comment https://forums.phpfreaks.com/topic/151521-sendmailphp-sends-two-emails/#findComment-795900 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.