From c2e488c8e7605a934d8ded3fac04b6ef4e4846d7 Mon Sep 17 00:00:00 2001 From: troy Date: Sun, 18 Dec 2022 19:04:18 +0100 Subject: [PATCH] added functional php mail --- mail.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/mail.php b/mail.php index 0fe2399..e0603dd 100644 --- a/mail.php +++ b/mail.php @@ -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(''.$text.''); + $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!'; } }