AnsweredAssumed Answered

How to set Opt Out for invalid Emails through Logic Hook using beans?

Question asked by Abhi Abhi on Dec 3, 2014
Latest reply on Dec 3, 2014 by Abhi Abhi
Using CE 6.5 I have an after_save logic hook which will send the mail as follow 

function mail_chk(&$focus, $event, $arguments)
  {
    require_once('include/SugarPHPMailer.php');
    $emailObj = new Email();
    // echo '
';
    // print_r($emailObj);
    echo '
';
    echo $focus->opt_out = 1 ;
    // $focus->webtolead_email_opt_out = 1;
    print_r($focus);
    die;
    $defaults = $emailObj->getSystemDefaultEmail();
    $mail_c = new SugarPHPMailer();
    $mail_c->setMailerForSystem();
    $mail_c->From = $defaults['email'];
    $mail_c->FromName = $defaults['name'];
    $mail_c->Subject = "Greetings From Salusfin";
    $mail_c->Body = "Thank you very much for contacting us and interest in our products, our marketing team will get back to you as soon as possible";
    $mail_c->prepForOutbound();
    $mail_c->AddAddress($focus->email1);
    $mail_c->IsHTML(true);
    @$mail_c->Send();

}  want to do something like                                            if email if failed to send                                            than set that mail to opt_out

is there any way to set opt_out email for leads using beans in logic hook  ??????

Outcomes