ok, here are the result from the 3 attempts I made:
attempt #1:
code used:
ini_set(“include_path”, “PHPMailer”);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require “…/PHPMailer/src/PHPMailer.php”;
require “…/PHPMailer/src/SMTP.php”;
require “…/PHPMailer/src/Exception.php”;
//Create a new PHPMailer instance
$mail = new PHPMailer(true); // Passing true
enables exceptions
try {
//Server settings
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = ‘smtpout.secureserver.net’; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ‘[email protected]’; // SMTP username
$mail->Password = ‘password’; // SMTP password
$mail->SMTPSecure = ‘ssl’; // Enable TLS encryption, ssl
also accepted
$mail->Port = 25; // TCP port to connect to
//Recipients
$mail->setFrom('[email protected]', 'Corporate');
$mail->addAddress('[email protected]', 'Adam'); // Add a recipient
$mail->addReplyTo('[email protected]', 'Adam');
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in 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;
}
the above resulted in this error:
Message could not be sent. Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
attempt #2)
code used:
ini_set(“include_path”, “PHPMailer”);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require “…/PHPMailer/src/PHPMailer.php”;
require “…/PHPMailer/src/SMTP.php”;
require “…/PHPMailer/src/Exception.php”;
//Create a new PHPMailer instance
$mail = new PHPMailer(true); // Passing true
enables exceptions
try {
//Server settings
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = ‘p3plcpnl0398.prod.phx3.secureserver.net’; // Specify main and backup SMTP servers
$mail->SMTPAuth = false; // Enable SMTP authentication
$mail->Username = ‘’; // SMTP username
$mail->Password = ‘’; // SMTP password
$mail->SMTPSecure = ‘’; // Enable TLS encryption, ssl
also accepted
$mail->Port = 25; // TCP port to connect to
$mail->SMTPAutoTLS = false; // Prevents opportunistic TLS encryption
//Recipients
$mail->setFrom('[email protected]', 'Corporate');
$mail->addAddress('[email protected]', 'Adam'); // Add a recipient
$mail->addReplyTo('[email protected]', 'Adam');
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in 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;
}
the result of attempt #2:
*Message has been sent*
And I got the email in the gmail inbox with all specs that are in my script! I didn’t even try attempt #3 cuz this worked! Hooray! Can you believe it took this long!?