<?php
require dirname(__DIR__)."/vendor/autoload.php";
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
testEmail();
function testEmail(){
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'mail.etradedynamics.ltd'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'admin@etradedynamics.ltd'; //SMTP username
$mail->Password = 'wN8iC8zA1f'; //SMTP password
$mail->SMTPSecure = '';
$mail->Port = 25; //465,587 ?
$mail->SMTPAutoTLS = false;
//Recipients
$mail->setFrom('admin@etradedynamics.ltd', 'Mailer');
$mail->addAddress('john@pearcey.net', 'John Pearcey'); //Add a recipient
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Test email from Lars server';
$mail->Body = 'A <b>test</b> email';
$mail->AltBody = '';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
var_dump($e->getTraceAsString());
echo "Mailer Error: {$mail->ErrorInfo}\n";
}
}
?>