AnsweredAssumed Answered

Set Opt Out for invalid Emails Logic Hook

Question asked by Shad on Mar 21, 2014
Latest reply on Mar 21, 2014 by Shad
Using CE 6.5 I have an after_save logic hook that sends an email based on a checkbox. To reduce emails going out to bogus addresses I want to do a quick check to verify.

Below is the to check email domain MX. When it runs I do enter the if statement but the table is not updated. Thinking there is some activity afterwards that is overriding as I've ran the statement directly and works fine. 
 $domain = explode("@", $borrower_email, 2);           
$domain[1] = strtolower($domain[1]);
          if(!checkdnsrr($domain[1], "MX")){
             global $db;
              $date = date('Y-m-d H:i:s');
              $sql = "UPDATE email_addresses SET invalid_email =1, opt_out = 1 date_modified = '$date' WHERE id = '$email_id' LIMIT 1";
              $rslt = $db->query($sql);
              if($rslt){return FALSE;}