Jump to content

Recommended Posts

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!");
  
  
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/151521-sendmailphp-sends-two-emails/
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.