isSMTP();
$mail->Host = $_POST['server']; // Client's mail server
$mail->SMTPAuth = true;
$mail->Username = $_POST['username']; // Client's email username
$mail->Password = $_POST['password']; // Client's password
if ($_POST['encryption'] != "none") {
$mail->SMTPSecure = $_POST['encryption'];
}
else {
$mail->SMTPSecure = false;
$mail->SMTPAutoTLS = false;
}
$mail->Port = $_POST['port']; // SMTP Port
// Mail configuration
$mail->setFrom($_POST['from-email'], 'Tester'); // Email From field
// Recipient info
$mail->addAddress($_POST['recipient-email']); // Email To field
$mail->Subject = 'PHPMailer over SMTP Test'; // Email Subject field
$mail->Body = 'This email has been sent using PHPMailer (over SMTP) for test purposes.'; // Email Body field
// Send email report
if(!$mail->send()) {
echo 'Message could not be sent.
';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.
';
echo 'Server: ' . $_POST['server'] . '
';
echo 'Port: ' . $_POST['port'] . '
';
echo 'Encryption: ' . $_POST['encryption'] . '
';
echo 'Username: ' . $_POST['username'];
}