I am developing a php script to deliver emails sent from my clients' site email form.
I copied and modified a script they I found at flash-db.com, it's very simple and it works perfectly, the only think is that I would like to modify further the script in order to have the capability of sending copies in Cc: or Bcc:.
here is the code:
<?php
// A revised version of snowMailPHP_revised.php from Flash-db by tommix.
$ToEmail = "youremail@yourserver.tld";
$ToName = "your name";
$FromName = $HTTP_POST_VARS["FromName"];
$FromEmail = $HTTP_POST_VARS["FromEmail"];
$FromTelephone = $HTTP_POST_VARS["FromTelephone"];
$FromSubject = $HTTP_POST_VARS["FromSubject"];
$FromMessage = $HTTP_POST_VARS["FromMessage"];
// The subject of your email.
$ToSubject = "from YourSite.com: $FromSubject";
// This is a sample message. The \n's are line breaks. You can alter this message anyway you want. It will be the main body of your email.
$Message = "Message sent from YourSite.com\n------------------------------------------------------------\n\nSent by: $FromName\nEmail: $FromEmail\nTelephone: $FromTelephone\n\n------------------------------------------------------------\nSubject: $FromSubject\n------------------------------------------------------------\nMessage:\n\n$FromMessage\n";
// This line actually sends the mail. For more information on this please visit:
// www.php.net/manual/en/function.mail.php
mail("<".$ToEmail.">",$ToSubject, $Message, "From: ".$FromName." <".$FromEmail.">");
// Thank you page.
Header("Refresh: 0;url= http://www.yoursite.com/thankyou_page.htm");
?>
Following some samples in the php manual I modified the mail() function as follows:
mail("<".$ToEmail.">",$ToSubject, $Message, "From: ".$FromName." <".$FromEmail.">\nCc: <ccemail@yourserver.tld>");
I am not a good programmer, I don't always know what I do, but the strange part is that I receive the message on the main To: address and it show the Cc: address correctly, but I don't receive the message on that other address.
Any ideas or alternative solutions?
Thanks