I am trying to send an email depending on a variable value, the code, is correct in that it does go into the correct branch of the code however the mail is not sent, does anyone know why? I have included the code below, thanks in advance
<code>
if($TravelRequest[3]=="CGB"
{
$toaddress="derek.smith@db.com";
$subject="You are from CGB, sent to Kim";
$mailcontent=" I want to visit NY";
mail($toaddress, $subject, $mailcontent);
echo "Attempted to send the email to UK";
}
else if($TravelRequest[3]=="CUS"
{
$toaddress="derek.smith@db.com";
$subject="You are from CUS, sent to Joyce";
$mailcontent="I want to visit London";
mail($toaddress, $subject, $mailcontent);
echo "Attempted to send the email to US";
}
else
{
echo " Not found the region!!!";
}
</code>
<code>
if($TravelRequest[3]=="CGB"
{
$toaddress="derek.smith@db.com";
$subject="You are from CGB, sent to Kim";
$mailcontent=" I want to visit NY";
mail($toaddress, $subject, $mailcontent);
echo "Attempted to send the email to UK";
}
else if($TravelRequest[3]=="CUS"
{
$toaddress="derek.smith@db.com";
$subject="You are from CUS, sent to Joyce";
$mailcontent="I want to visit London";
mail($toaddress, $subject, $mailcontent);
echo "Attempted to send the email to US";
}
else
{
echo " Not found the region!!!";
}
</code>