logService = new LogService();
$this->smtp_allowed = $smtp_allowed;
}
public function isValidEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
function send($to, $subject, $body, $msgKey = null) {
if ($this->smtp_allowed === true && $this->canSendMsg($msgKey)) {
$mail = new PHPMailer(true);
$mail->isSMTP();
// From
$mail->FromName = NOMAPPLICATION;
$mail->From = ADRESSEMAILADMIN;
if ($this->isValidEmail(ADRESSEMAILREPONSEAUTO)) {
$mail->addReplyTo(ADRESSEMAILREPONSEAUTO);
}
// To
$mail->addAddress($to);
// Subject
$mail->Subject = $subject;
// Bodies
$body = $body . '
' . __('Mail', 'Thanks for your trust.') . '
' . NOMAPPLICATION . '