53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
//You shall use the following exact namespaces no
|
|
//matter in whathever directory you upload your
|
|
//phpmailer files.
|
|
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
use PHPMailer\PHPMailer\Exception;
|
|
//include('include/headscript.php');
|
|
require 'phpmailer/src/Exception.php';
|
|
require 'phpmailer/src/PHPMailer.php';
|
|
require 'phpmailer/src/SMTP.php'; ?>
|
|
<?php
|
|
if (isset($_GET["tokenupdate"])) {
|
|
|
|
//smtp
|
|
|
|
$mail = new PHPMailer(true);
|
|
try {
|
|
$mail->isSMTP(); // Set mailer to use SMTP
|
|
$mail->Host = $mailhost; // Specify main and backup server
|
|
$mail->SMTPAuth = true; // Enable SMTP authentication
|
|
$mail->Username = $mailusername; // SMTP username
|
|
$mail->Password = $mailpassword; // SMTP password
|
|
$mail->SMTPSecure = $mailmethod; // Enable encryption, 'ssl' also accepted
|
|
$mail->Port = $mailport;
|
|
|
|
|
|
$mmessage="mailtoken";
|
|
include('include/mailhtml.php');
|
|
// Email body content
|
|
|
|
|
|
$htmlContent = $mailmessagetoken;
|
|
|
|
|
|
$mail->From = $from;
|
|
$mail->FromName = 'CIMAC Application Form System';
|
|
$mail->addAddress($to); // Add a recipient
|
|
|
|
|
|
|
|
$mail->Subject = $subject;
|
|
$mail->Body = $htmlContent;
|
|
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
|
|
|
$mail->send();
|
|
// echo 'Message has been sent';
|
|
} catch (Exception $e) {
|
|
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
|
}}
|
|
?>
|
|
|
|
|