Hi,
I added an event that sends an email every time I edit a record.
That part works fine.
The only problem is that the email is being sent twice.
Can anyone help me please?
// After record updated
function AfterEdit(&$values, $where, &$oldvalues, &$keys,$inline)
{
// ********** Send conformation email ************
ini_set('SMTP','smtp.xxxxxx.nl');
$html = true;
// variables
$to = $values["email"];
$from = "info@xxxxxxx.nl";
$subject = "Voortgang schade van ".$values["Schadedatum"];
$message = $values["Commentaar"] . "<br />" . "<br />" . "<br />" . "<br />";
$message .= 'Met vriendelijke groet,' . "<br />";
$message .= 'Administratie';
//Headers
$headers = "To: $to" . "\r\n";
$headers .= "From: $from" . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'X-Priority: Normal' . "\r\n";
$headers .= ($html) ? 'MIME-Version: 1.0' . "\r\n" : '';
$headers .= ($html) ? 'Content-type: text/html; charset=iso-8859-1' . "\r\n" : '';
// Send the message
mail($to, $subject, $message, $headers);
header("Location:Part__schades_list.php?a=return");
exit();
} // function AfterEdit
/ After record added
function AfterAdd(&$values,&$keys,$inline)
{
// Parameters:
// $values - Array object.
// Each field on the Add form is represented as a 'Field name'-'Field value' pair
// $keys - Array object with added record key column values
//********** Redirect to another page ************
header("Location:Part__schades_list.php?a=return");
exit();
} // function AfterAdd
?>