diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/class/globals.php | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/app/class/globals.php b/app/class/globals.php index 0d4b0ac..615efa6 100644 --- a/app/class/globals.php +++ b/app/class/globals.php @@ -12,10 +12,6 @@ * For more information, please refer to UNLICENSE */ -require_once "class/settings.class.php"; -require_once "class/phpmailer.class.php"; -require_once "class/smtp.class.php"; - /* * This file defines various functions which exist in the global namespace. * These are utility functions and constants for the Scrott application. @@ -148,42 +144,4 @@ function saveFile(array $file, string $path, int $maxsize, ?array $allowedMime = return true; } -/* - * Send an email message using database-stored configuration - * parameters. If config is not established, delivery is - * not attempted. Send status (t/f) is returned. - */ -function sendEmail(string $subject, user $rcpt, string $mesg, - ?string $attachPath = NULL, ?string $attachName = NULL, - bool $overrideEmailConf = false) : bool -{ - if (settings::smtpServer() == "") - return false; - - if (!$overrideEmailConf && !$rcpt->emailConf) - return true; - - if ($rcpt->email == "") - return true; - - $mail = new PHPMailer(); - $mail->isSMTP(); - $mail->SMTPAuth = true; - $mail->Host = settings::smtpServer(); - $mail->Username = settings::smtpUname(); - $mail->Password = settings::smtpPasswd(); - $mail->SMTPSecure = settings::smtpSecurity(); - $mail->Port = settings::smtpPort(); - - $mail->setFrom(settings::smtpEmailAddress()); - $mail->addAddress($rcpt->email, $rcpt->getDisplayName()); - $mail->Subject = $subject; - $mail->Body = $mesg; - - if ($attachPath && $attachName) - $mail->addAttachment($attachPath, $attachName); - - return $mail->send(); -} - ?> |