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 = "sam@mysite.com"; // 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!"); ?> Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/151521-sendmailphp-sends-two-emails/#findComment-795900 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.