diff --git a/MDErrorReporter.php b/MDErrorReporter.php index e2df86a..e6c1385 100644 --- a/MDErrorReporter.php +++ b/MDErrorReporter.php @@ -191,16 +191,17 @@ final class MDErrorReporter { $msg .= PHP_EOL . PHP_EOL; - $msg = shell_exec("echo " . escapeshellarg($msg) . " | gpg2 --always-trust --recipient " . escapeshellarg($to) . " --encrypt --armor --local-user 35CA0E31F6F44FB5 --sign"); + $msg = MDMailerHelper::pgp_encrypt($to, $msg); - // Set header - $header = [ - 'From' => $this->_contact_mail_addr, - 'X-Mailer' => 'PHP/' . phpversion() - ]; + $mail = MDMailerHelper::setup_PHPMailer(); + $mail->setFrom($this->_contact_mail_addr, $this->_contact_mail_addr); + $mail->addAddress($to); + $mail->addReplyTo(MD_CONF_EMAIL::SMTP_REPLY_TO_ERROR); + $mail->isHTML(false); + $mail->Subject = $subject; + $mail->Body = "$msg"; - // Send email - mail("$to", "$subject", "$msg", $header); + $mail->send(); }