From 5e2c016633c8c235dd04992e60672804d4da3fb1 Mon Sep 17 00:00:00 2001 From: "johnny@pittpc.com" Date: Mon, 8 Feb 2021 22:02:01 -0500 Subject: [PATCH] Added a test Email Functionality Section under settings - General - Mail --- post.php | 41 +++++++++++++++++++++++++++++++++++++++++ settings-mail.php | 14 ++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/post.php b/post.php index 92685f45..253bde25 100644 --- a/post.php +++ b/post.php @@ -386,6 +386,47 @@ if(isset($_POST['edit_mail_settings'])){ } +if(isset($_POST['test_email'])){ + $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); + + $mail = new PHPMailer(true); + + try{ + + //Mail Server Settings + + //$mail->SMTPDebug = 2; // Enable verbose debug output + $mail->isSMTP(); // Set mailer to use SMTP + $mail->Host = $config_smtp_host; // Specify main and backup SMTP servers + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = $config_smtp_username; // SMTP username + $mail->Password = $config_smtp_password; // SMTP password + $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted + $mail->Port = $config_smtp_port; // TCP port to connect to + + //Recipients + $mail->setFrom($config_mail_from_email, $config_mail_from_name); + $mail->addAddress("$email"); // Add a recipient + + // Content + $mail->isHTML(true); // Set email format to HTML + + $mail->Subject = "Hi'ya there Chap"; + $mail->Body = "Hello there Chap ;) Don't worry this won't hurt a bit, it's just a test. ${$email}"; + + + $mail->send(); + echo 'Message has been sent'; + + $_SESSION['alert_message'] = "Test Email has been sent!"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + + } catch (Exception $e) { + echo "poop"; + } +} + if(isset($_POST['edit_invoice_quote_settings'])){ $config_invoice_prefix = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_invoice_prefix'])); diff --git a/settings-mail.php b/settings-mail.php index a2abd75a..193af1e4 100644 --- a/settings-mail.php +++ b/settings-mail.php @@ -77,4 +77,18 @@ +
+
+

Test Email

+
+
+
+
+ +
+ +
+
+
+