|  | Posted by Tobierre on 11/22/05 13:55 
Hi all,
 I've created the below function to automatically send me an alert in outlook
 when someone completes various forms on my website.
 
 The problem though is that mail reports that I have only 1 of the 3 required
 parameters defined!
 
 I have no idea where this is going wrong, because as far as I can tell I
 have defined all 3 parameters! Can anyone spot the problem?
 
 Regards
 Tobierre
 
 
 <?PHP
 function alert_outlook($Type)
 {
 $Type = strtolower($Type);
 
 switch($Type)
 {
 case 'newsletter':
 $Subject = 'message subject one here';
 $Alert = "Hi,\n Just thought you would like to know that there has been
 another subscription to the newsletter!\n\n";
 break;
 
 $Alert = wordwrap($Alert, 65);
 }
 
 //set headers etc
 $Recipient = "Auto Alerts<AutoAlerts@domain.com>";
 
 $Message = "\n\n{$Alert}\n\n\n";
 $Message .= 'Date: ' . date("l, js F Y") . "\n";
 $Message .= 'Time: ' . date("H:i:s") . "\n";
 $Message .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . "\n\n";
 
 $Headers = "FROM: Auto Mailer<AutoMailer@Domain.com>\r\n";
 
 mail("$Recipient, $Subject, $Message, $Headers");
 
 //error check
 if(!mail("$Recipient, $Subject, $Message, $Headers"))
 {
 return FALSE;
 }
 else
 {
 return TRUE;
 }
 }
 ?>
  Navigation: [Reply to this message] |