Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail function, not sending the mail

Status
Not open for further replies.

Delboy14

Programmer
Jun 21, 2001
213
GB
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]==&quot;CGB&quot;)
{
$toaddress=&quot;derek.smith@db.com&quot;;
$subject=&quot;You are from CGB, sent to Kim&quot;;
$mailcontent=&quot; I want to visit NY&quot;;
mail($toaddress, $subject, $mailcontent);
echo &quot;Attempted to send the email to UK&quot;;
}
else if($TravelRequest[3]==&quot;CUS&quot;)
{
$toaddress=&quot;derek.smith@db.com&quot;;
$subject=&quot;You are from CUS, sent to Joyce&quot;;
$mailcontent=&quot;I want to visit London&quot;;
mail($toaddress, $subject, $mailcontent);
echo &quot;Attempted to send the email to US&quot;;
}
else
{
echo &quot; Not found the region!!!&quot;;
}

</code>
 
Try adding this somewhere;

if ($php_errormsg) { echo &quot;Error: $php_errormsg&quot;; }

Cheers

Andy
 
and are you sure the mailserver specified in php.ini is correct and working ok?
 
sorry, I have found out there are certain restrictions on the server, I just needed to apply to have my site registered to enable mail to be sent thanks for the posts though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top