php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
//Server settings
$mail-isSMTP();
$mail-Host = 'smtp.65.hk'; // Set the SMTP server to send through
$mail-SMTPAuth = true; // Enable SMTP authentication
$mail-Username = 'your_username@65.hk'; // SMTP username
$mail-Password = 'your_password'; // SMTP password
$mail-SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
$mail-Port = 587; // TCP port to connect to
//Recipients
$mail-setFrom('from@65.hk', 'Mailer');
$mail-addAddress('recipient@65.hk', 'Joe User'); // Add a recipient
// Content
$mail-isHTML(true); // Set email format to HTML
$mail-Subject = 'Here is the subject';
$mail-Body = 'This is the HTML message body <bin bold!</b';
$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};
}
?