phpmailer error
use the phpmailer library and I have the ports open-----------
Starting Nmap 7.70 ( https://nmap.org ) at 2024-05-11 16:16 CDT
Nmap scan report for sil.pcgil.net (45.33.13.46)
Host is up (0.0000070s latency).
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
443/tcp open https
465/tcp open smtps
3306/tcp open mysql
error------>>>
"2024-05-11 21:09:38 SMTP ERROR: Failed to connect to server: Connection timed out (110)
2024-05-11 21:09:38 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Fatal error: Uncaught phpmailerException: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting in /var/www/html/gilstore_silva/lib/mailer/class.phpmailer.php:1312
Stack trace:
0 /var/www/html/gilstore_silva/lib/mailer/class.phpmailer.php(1156): PHPMailer->smtpSend('Date: Sat, 11 M…', '<div style="\n\t\t…')
1 /var/www/html/gilstore_silva/lib/mailer/class.phpmailer.php(1060): PHPMailer->postSend()
2 /var/www/html/gilstore_silva/controller/correo.php(575): PHPMailer->send()
3 /var/www/html/gilstore_silva/controller/correo.php(470): sendEmail(Array, 'Cotizacion EP S…', '<div style="\n\t\t…', '../files/1/coti…', '')
4 {main}
thrown in /var/www/html/gilstore_silva/lib/mailer/class.phpmailer.php on line 1312
"
php code----
$mail = new PHPMailer(true);
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->FromName = "name company";
if($dt['EMAIL']!="" && $dt['PASS']!="" ){
$mail->From = $dt['EMAIL'];
$mail->Username = $dt['EMAIL'];
$mail->Password = $dt['PASS'];
$mail->Mailer = "smtp";
$mail->SMTPSecure = 'ssl';
$mail->Host = $dt['SMTP'];// //smt.ejemplo.com
$mail->Port = $dt['PORT'];// 465
}
$mail->DKIM_domain = 'ejemplo.com';
$file=file_get_contents('key.private');
$mail->DKIM_private = $file;
$mail->DKIM_selector = 'hmail._dkim.';
$mail->DKIM_passphrase = '*';
$mail->DKIM_identity = $mail->From;
$mail->SMTPAuth = true;
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
Please help, I'm a new???????????
1 Reply
I found some forum discussion that suggests this may be a GoDaddy specific issue with your domain:
As that forum explains, they block all outgoing SMTP requests on ports 25, 465, and 587 to third-party servers, as well as from free accounts such as gmail.
Alternatively, the following StackOverflow post goes into detail about creating a mailing host through gmail and how to ensure all of your SMTP server data is correct: