I have a support form where the users have to enter their company name as free text and the country from a drop down. They get a unique ID no. for their problem and we get a mail with all the info.
I want to send a copy of the mail to three recipients ONLY when a certain company name AND a certain country is given by the user. I written the following code which sends copies no matter what company name or country I enter:
$recipient = "<me@us.com>";
$subject = "Supportformular - Nr. ".$ID."";
$headers = "From: ".$visitor_name."<".$visitor_email_address.">\n";
$headers .= "X-Sender: <me@us.com>\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "Return-Path: <support@logo-consult.de>\n";
if (($Firma = "certain company name")&&($country = "certain country"))
{
$headers .= "cc:mrx@them.com, mrsy@them.com, mrz@them.com";
}
mail($emp, $subject, $nachricht, $headers);
I'm grateful to anyone who can point me in the right direction.
karambos