Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

ERROR: Failed to connect to server: Connection refused (111) , godaddy

using phpmailer, I want to send email using godaddy linux shared server
(the client wont move their website to another host)


this works for me on other hosts and localhost, but not godaddy
SMTP -> ERROR: Failed to connect to server: Connection refused (111)
SMTP Error: Could not connect to SMTP host.


I saw this question many times on stackoverflow.com godaddy, where it says it can not be done


$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "gmailName@gmail.com";  // GMAIL username
Avatar of Gary
Gary
Flag of Ireland image

Have you got Always use a secure connection set in Godaddy.
Avatar of rgb192

ASKER

is this in a godaddy control pannel
Scrap that, I thought you were using Godaddys smtp server, you need to use GoDaddys relay server - don't blame Gmail,it's all the spam that comes from Godaddy
relay-hosting.secureserver.net.
Avatar of rgb192

ASKER

want to send gmail email not godaddy email
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

>> EE_Q_27918373

I used mail()


so with godaddy I can't work 4 parameter mail (to another gmail address) and phpmailer()


I can only use 3 parameter mail()
I must be missing something.  In EE_Q_27918373 the content of the mail message had a "From" and a "Reply-to" header that contained my email address.  Since I did not sent that message, I am assuming that you sent it using some kind of automation like the mail() function.  That would seem to imply that the mail() function call had four parameters, the last being the additional headers to show From and Reply-to.

                                                                                                                                                                                                                                                               
Delivered-To: ray.paseur@gmail.com
Received: by 10.217.5.194 with SMTP id w44csp261137wes;
        Mon, 5 Nov 2012 19:07:47 -0800 (PST)
Received: by 10.69.1.1 with SMTP id bc1mr36303454pbd.102.1352171266423;
        Mon, 05 Nov 2012 19:07:46 -0800 (PST)
Return-Path: <bottleclub@p3nlhssl050.shr.prod.phx3.secureserver.net>
Received: from p3nlsmtp20.shr.prod.phx3.secureserver.net (p3nlsmtp20.shr.prod.phx3.secureserver.net. [72.167.234.245])
        by mx.google.com with ESMTP id r8si25748071pay.301.2012.11.05.19.07.45;
        Mon, 05 Nov 2012 19:07:46 -0800 (PST)
Received-SPF: pass (google.com: domain of bottleclub@p3nlhssl050.shr.prod.phx3.secureserver.net designates 72.167.234.245 as permitted sender) client-ip=72.167.234.245;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of bottleclub@p3nlhssl050.shr.prod.phx3.secureserver.net designates 72.167.234.245 as permitted sender) smtp.mail=bottleclub@p3nlhssl050.shr.prod.phx3.secureserver.net
Received: from p3nlhssl050.shr.prod.phx3.secureserver.net ([97.74.215.209])
	by p3nlsmtp20.shr.prod.phx3.secureserver.net with 
	id L37l1k00b4XepqR0137lmT; Mon, 05 Nov 2012 20:07:45 -0700
Received: from p3nlhssl050.shr.prod.phx3.secureserver.net (localhost [127.0.0.1])
	by p3nlhssl050.shr.prod.phx3.secureserver.net (8.13.8/8.12.11) with ESMTP id qA637jGM010914
	for <Ray.Paseur@gmail.com>; Mon, 5 Nov 2012 20:07:45 -0700
Received: (from bottleclub@localhost)
	by p3nlhssl050.shr.prod.phx3.secureserver.net (8.13.8/8.12.11/Submit) id qA637jDY010911;
	Mon, 5 Nov 2012 20:07:45 -0700
Date: Mon, 5 Nov 2012 20:07:45 -0700
Message-Id: <201211060307.qA637jDY010911@p3nlhssl050.shr.prod.phx3.secureserver.net>
To: Ray.Paseur@gmail.com
Subject: EE_Q_27918373
From: Ray.Paseur@gmail.com
Reply-To: Ray.Paseur@gmail.com

I can send mail() with 3 parameters where senders is secureserver.net address. If I send email with four parameters the sender must be the recipient(if I use gmail).  If I use yahoo, the sender and recipient can be different.

Open in new window

Avatar of rgb192

ASKER

same godaddy shared server where client does not want to switch to hostgator/liquidweb/other choice

on EE_Q_27918373 question we used php mail()

so I wanted to use phpmailer()  for this question

goadaddy refuses to open port 465.  
so I wanted to know if gmail allowed me to not use a secure connection
or gmail allows another port (80 or 25)
Avatar of rgb192

ASKER

$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
//$mail->SMTPSecure = "tls";
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Port       = 587;                   // set the SMTP port for the GMAIL server


tried not using port 465 and got same error
SMTP -> ERROR: Failed to connect to server: Connection refused (111)
SMTP Error: Could not connect to SMTP host.
Avatar of rgb192

ASKER

not the answer to this question (per say)

but caused me to think of another question

https://www.experts-exchange.com/questions/27927559/shared-hosting-options.html