Problem sending mail in php

Hi, I have on my site created an automatic email sending system for registering an account, everything is configured well with php mailer, I have no code errors but when I want to send the email, this appears: Error sending email: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Here is my configuration:

$mail->isSMTP();
$mail->Host = 'smtp-mail.outlook.com'; // Outlook SMTP server
$mail->SMTPAuth = true;
$mail->Username = 'email'; // Your email address
$mail->Password = 'password'; // Your email password
$mail->SMTPSecure = ''; // No encryption
$mail->Port = 25; // Standard port without encryption

What makes it not work?

These settings make it not work.

Microsoft’s instructions say you should use port 587 with STARTTLS encryption (which PHPMailer calls tls).

SMTP port 25 is mainly used to exchange messages between mail servers, not clients and mail servers, which is why that port is blocked in many places, including on our servers. So even if Microsoft would accept email on that port (which they most likely don’t), then you still wouldn’t be able to do it from our hosting.

3 Likes

have solved ! (GitHub - InfinityFreeHosting/contactform: Simple contact form with PHPMailer)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.