bboyjackson
New Pleskian
Hi everyone,
I am trying to send emails from my website using PHPMailer with my Plesk server's SMTP configuration. However, the emails are not being sent, and I am unsure if my configuration is correct or if something else needs to be enabled in Plesk.
Here is the code I am using for testing purposes:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$mail = new PHPMailer(true);
try {
// SMTP configuration
$mail->isSMTP();
$mail->Host = 'mail.tiptoplaptop.nl'; // SMTP server of my domain
$mail->SMTPAuth = true;
$mail->Username = '[email protected]'; // My email address
$mail->Password = '*****'; // My password (hidden for security)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
// Sender
$mail->setFrom('[email protected]', 'TipTop Laptop');
// Receiver
$mail->addAddress('[email protected]'); // Test recipient
// Email content
$mail->isHTML(true);
$mail->Subject = 'Test email to Gmail';
$mail->Body = '<h1>This is a test</h1><p>Email sent successfully!</p>';
// Send email
$mail->send();
echo 'Email sent successfully!';
} catch (Exception $e) {
echo "Email could not be sent. Error: {$mail->ErrorInfo}";
}
?>
I am trying to send emails from my website using PHPMailer with my Plesk server's SMTP configuration. However, the emails are not being sent, and I am unsure if my configuration is correct or if something else needs to be enabled in Plesk.
Here is the code I am using for testing purposes:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$mail = new PHPMailer(true);
try {
// SMTP configuration
$mail->isSMTP();
$mail->Host = 'mail.tiptoplaptop.nl'; // SMTP server of my domain
$mail->SMTPAuth = true;
$mail->Username = '[email protected]'; // My email address
$mail->Password = '*****'; // My password (hidden for security)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
// Sender
$mail->setFrom('[email protected]', 'TipTop Laptop');
// Receiver
$mail->addAddress('[email protected]'); // Test recipient
// Email content
$mail->isHTML(true);
$mail->Subject = 'Test email to Gmail';
$mail->Body = '<h1>This is a test</h1><p>Email sent successfully!</p>';
// Send email
$mail->send();
echo 'Email sent successfully!';
} catch (Exception $e) {
echo "Email could not be sent. Error: {$mail->ErrorInfo}";
}
?>
The Problem:
- The email is not being sent.
- I am not receiving any error messages, or sometimes I see this: SMTP connect() failed.
Additional Information:
- My domain: tiptoplaptop.nl
- Plesk settings seem correct (SMTP is enabled).
- My DNS records include SPF, DKIM, and DMARC.
- I am testing with a Gmail address as the recipient ([email protected]).
Question:
- Is there anything additional I need to configure in Plesk for this to work?
- Are there known limitations or restrictions with outgoing mail that I need to check?
- How can I troubleshoot this issue further?