hello I know error that I cannot resolve this eueu
2024-12-14 17:48:11 SMTP ERROR: Failed to connect to server: Connection refused (111) 2024-12-14 17:48:11 SMTP Error: Could not connect to SMTP host. Erreur lors de l'envoi du message : SMTP Error: Could not connect to SMTP host.
and I want to avoid using a relay
<?php error_reporting(E_ALL); ini_set("display_errors", 1);
require 'PHPMailer-6.6.0/src/PHPMailer.php';
require 'PHPMailer-6.6.0/src/SMTP.php';
require 'PHPMailer-6.6.0/src/Exception.php';
use PHPMailerPHPMailerPHPMailer; use PHPMailerPHPMailerException;
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'domainname.org';
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'echo';
$mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) );
$mail->Username = '[email protected]';
$mail->Password = 'MonMotDePasse123';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; activé
$mail->Port = 587;
$mail->setFrom('[email protected]', 'Mon Site Web');
$mail->addAddress('[email protected]', 'Nom Destinataire');
$mail->addReplyTo('[email protected]', 'Support VEX');
$mail->isHTML(true);
$mail->Subject = 'Sujet de l'email';
$mail->Body = '<h1>Ceci est un test</h1><p>Message envoyé depuis domainname.org.</p>';
$mail->AltBody = 'Ceci est un test. Message envoyé depuis domainname.org.';
$mail->send();
echo 'Message envoyé avec succès !';} catch (Exception $e) {echo "Erreur lors de l'envoi du message : {$mail->ErrorInfo}";}?>`
and Port 25,587 are open and in the firewall
under debian
telnet ``domainname``org 587 Trying ip.ip.ip.180... telnet: Unable to connect to remote host: Connection refused root@raspberrypi:~#
I configured the MX Record on noip and I looked for the Internet service provider but it does not seem to put a retission
root@raspberrypi:~# telnet smtp.gmail.com 25 Trying 2a00:1450:400c:c0c::6c… Connected to smtp.gmail.com. Escape character is ‘^]’. 220 smtp.gmail.com ESMTP ffacd0b85a97d-388c8016326sm8340120f8f.34 – gsmt
thanks in advance
thesolar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4