I'm trying to get an e-mail sent based on a field being updated. For the past 6 months I've been using the command below:
if ($oldvalues["PP_S35_DATE"] != $values["PP_S35_DATE"]) {
// ** Send simple email ****
$email="jbarreras@srdcommercial.com";
$from="contact@saundersrealestate.com";
$msg="Price Change ".$values["Marketing Title"]." listing. ".$values["Listing Agent"]." has updated the price. Please begin the Price Change Protocol";
$subject="Price Change: ".$values["Marketing Title"];
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
}
And it's been working great. So at this point, I'm trying to make it to send an e-mail based on another field being updated. My first guess was to just add another if e-mail statement like below:
if ($oldvalues["PP_S35_DATE"] != $values["PP_S35_DATE"]) {
// ** Send simple email ****
$email="jbarreras@srdcommercial.com";
$from="contact@saundersrealestate.com";
$msg="Price Change ".$values["Marketing Title"]." listing. ".$values["Listing Agent"]." has updated the price. Please begin the Price Change Protocol";
$subject="Price Change: ".$values["Marketing Title"];
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
}
if ($oldvalues["PP_S2_DATE"] != $values["PP_S2_DATE"]) {
// ** Send simple email ****
$email="jbarreras@srdcommercial.com";
$from="contact@saundersrealestate.com";
$msg="Please begin to process the ".$values["Marketing Title"]." listing. ".$values["Listing Agent"]." has completed the Listing Inofrmation Sheet and the project is now ready to begin the marketing process";
$subject="New Listing: ".$values["Marketing Title"];
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
}
But it doesn't work. With the above changes, I get both e-mails regardless of if I updated either field or not.
I've also tried elseif for the 2nd if statement to no avail.
I'm baffled please help.