I am currently having this issue on a MediaTemple Grid server.
I am using PHP Mailer and I have the following code:
require_once("inc/class.phpmailer.php");
// Mail from contact form for me
$mail = new PHPMailer();
$mail -> IsSMTP();
$mail -> CharSet = "UTF-8";
$mail -> SetFrom($_POST["email"],$_POST["name"]);
$mail -> AddReplyTo($_POST["email"],$_POST["name"]);
$mail -> AddBCC("myaddress@mydomain.yep");
$mail -> Subject = "Mail Subject";
$body = "... some html ...";
$mail -> MsgHTML($body);
// Automatic mail for the person that contacted me
$mail_customer = new PHPMailer();
$mail_customer -> IsSMTP();
$mail_customer -> CharSet = "UTF-8";
$mail_customer -> SetFrom("contact@mydomain.yep","Contact");
$mail_customer -> AddReplyTo("contact@mydomain.yep","Contact");
$mail_customer -> AddAddress($_POST["email"],$_POST["name"]);
$mail_customer -> Subject = "Thank you for contacting us!";
$body_customer = "... some html ...";
$mail_customer -> MsgHTML($body_customer);
$mail -> Send();
$mail_customer -> Send();
When this is over there are no errors, but for some reason I get three e-mails.
- $mail - from $_POST["email"]
- $mail - from root@localhost - this has the exact same message body but without the $_POST data
- $mail_customer - that arrives to $_POST["email"] without other mails.
What could be causing this and how could I fix it? Does it have to do with PHP Mailer or with server configuration?