Use PHPMailer in sending email bug reports

This commit is contained in:
Joshua Ramon Enslin 2020-10-21 12:06:42 +02:00 committed by Stefan Rohde-Enslin
parent ef00d81c1d
commit c13d06eccb
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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();
}