Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

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 ************, timeout=300, options=array()
2017-11-08 14:56:44 Connection failed. Error #2: stream_socket_client(): unable to connect to ************ (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.
Mailer Error: SMTP connect() failed.


I followed the settings here option 2 direct send:


This is the code in my email script:

$mail = new PHPMailer;
$mail->SMTPDebug  = 4;
$mail->Host = '************';
$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';


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->Host = '';
$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?

Former Employee

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.

Warm regards,