added functional php mail

This commit is contained in:
troy 2022-12-18 19:04:18 +01:00
parent 59b5ffc82f
commit c2e488c8e7

View File

@ -58,34 +58,23 @@ function send_html_mail($an, $betreff, $text, $ok = '', $error = '') {
}
function send_php_mail($an, $betreff, $text, $ok = '', $error = '') {
//$boundary = md5($an.$betreff.$text.time());
include 'secret.php';
$sender = 'noreply@troy-grunt.de';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
include 'php-mailer/SMTP.php';
include 'php-mailer/PHPMailer.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = SMTP::DEBUG_OFF;
$mail->Host = $_smtp['srv'];
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = $_smtp['user'];
$mail->Password = $_smtp['pw'];
$mail->setFrom($sender);
$mail->addAddress($an);
$mail->Subject = $betreff;
$mail->msgHTML('<html><body>'.$text.'</body></html>');
$mail->msgHTML($text, __DIR__);
$mail->AltBody = strip_tags($text);
//$mail->addAttachment('images/phpmailer_mini.png');
if (!$mail->send()) {
echo $error;
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo $ok;
echo 'Message sent!';
}
}