cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution
New

PHPMailer smtp error connection refused

I created an email script using phpmailer smtp and receiving this error:

2017-11-08 14:56:42 Connection: opening to ************.mail.protection.outlook.com:25, timeout=300, options=array()
2017-11-08 14:56:44 Connection failed. Error #2: stream_socket_client(): unable to connect to ************.mail.protection.outlook.com:25 (Connection refused) [/home/ashburnpower/public_html/PHPMailer/src/SMTP.php line 325]
2017-11-08 14:56:44 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

I followed the settings here option 2 direct send:

https://support.office.com/en-us/article/How-to-set-up-a-multifunction-device-or-application-to-send...

 

This is the code in my email script:

$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug  = 4;
$mail->Host = '************.mail.protection.outlook.com';
$mail->Port = 25;
$mail->SMTPSecure = 'tls';

$mail->SetFrom('FromEmail@************.com', 'FromEmail');
$mail->addAddress('ToEmail@************.com', 'ToEmail');
$mail->Subject = 'You have received a message from ************.com';

$mail->msgHTML($content);

if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

 

I've also tried the Godaddy fix found in the troubleshooting page:

$mail->isSMTP();
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;

 

But I'm still getting the same error. Can anyone please tell me what's causing the error?

1 REPLY 1
3fk
Former Employee
Solution

Re: PHPMailer smtp error connection refused

Hello @karll

Try going to your cPanel Page

Look for "Mx Entry" Click it then set it to "remote"

Then go to "PHP Processes" hit "Kill prcesses"

Test it, if no go contact support , I recommend chat support. you may find it here from the top right.

https://uk.godaddy.com/community

Warm regards,

Joven