1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- require '../lib/phpmailer/Exception.php';
- require '../lib/phpmailer/PHPMailer.php';
- require '../lib/phpmailer/SMTP.php';
- require_once ('../config/linequest.php');
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\SMTP;
- use PHPMailer\PHPMailer\Exception;
- function send_mail($recipient, $subject, $message) {
- global $CFG;
- $mail = new PHPMailer(true);
- $mail->isSMTP();
- $mail->SMTPDebug = 2;
- $mail->Host = $CFG->smtp->host;
- $mail->Port = $CFG->smtp->port;
- $mail->SMTPAuth = true;
- $mail->Username = $CFG->smtp->username;
- $mail->Password = $CFG->smtp->password;
- $mail->CharSet = 'UTF-8';
- $mail->setFrom($CFG->smtp->from, $CFG->smtp->from);
- $mail->addReplyTo($CFG->smtp->from, 'no-reply');
- $mail->IsHTML(true);
- $mail->addAddress($recipient, $recipient);
- $mail->Subject = $subject;
- $mail->Body = $message;
- return $mail->send();
- }
- ?>
|