Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on localhost but not on godaddy server #1488

Closed
aks30498 opened this issue Jul 3, 2018 · 16 comments
Closed

Working on localhost but not on godaddy server #1488

aks30498 opened this issue Jul 3, 2018 · 16 comments

Comments

@aks30498
Copy link

aks30498 commented Jul 3, 2018

am using this code:-

`$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = 'tls';
$mail->Host = "https://sg2plcpnl0207.prod.sin2.secureserver.net:......(the address of cpanel index)"; // SMTP server

$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->IsHTML(); // set the SMTP port for the GMAIL server
$mail->Username = "email@gmail.com"; // SMTP account username
$mail->Password = "password"; // SMTP account password
$mail->SetFrom('email@gmail.com','blah blah blah');

on localhost i used ssl and 465 and this thing worked but looking at forums on godaddy i changed it to tls 587 but it still shows SMTP connect() failed.. even at debug = 3

@Synchro
Copy link
Member

Synchro commented Jul 3, 2018

Host needs to contain a host name, not an HTTP URL. On GoDaddy it's something like relay.secureserver.net

@Synchro Synchro closed this as completed Jul 3, 2018
@aks30498
Copy link
Author

aks30498 commented Jul 3, 2018

@Synchro you mean this: sg2plcpnl0207.prod.sin2.secureserver.net right?
but using it shows this:

2018-07-03 07:42:02 SERVER -> CLIENT: 220-sg2plcpnl0207.prod.sin2.secureserver.net ESMTP Exim 4.89_1 #1 Tue, 03 Jul 2018 00:42:02 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. 2018-07-03 07:42:02 CLIENT -> SERVER: EHLO websitename.com 2018-07-03 07:42:02 SERVER -> CLIENT: 250-sg2plcpnl0207.prod.sin2.secureserver.net Hello sg2plcpnl0207.prod.sin2.secureserver.net [148.72.232.108] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-CHUNKING 250-STARTTLS 250 HELP 2018-07-03 07:42:02 CLIENT -> SERVER: STARTTLS 2018-07-03 07:42:02 SERVER -> CLIENT: 220 TLS go ahead 2018-07-03 07:42:02 CLIENT -> SERVER: EHLO websitename.com 2018-07-03 07:42:02 SERVER -> CLIENT: 250-sg2plcpnl0207.prod.sin2.secureserver.net Hello sg2plcpnl0207.prod.sin2.secureserver.net [148.72.232.108] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-CHUNKING 250 HELP 2018-07-03 07:42:02 CLIENT -> SERVER: AUTH LOGIN 2018-07-03 07:42:02 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2018-07-03 07:42:02 CLIENT -> SERVER: cHJhY3RpY2VtYWlsMzA0OThAZ21haWwuY29t 2018-07-03 07:42:02 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2018-07-03 07:42:02 CLIENT -> SERVER: QXVyb3JhX0JvcmVhbGlzOTg= 2018-07-03 07:42:04 SERVER -> CLIENT: 535 Incorrect authentication data 2018-07-03 07:42:04 SMTP ERROR: Password command failed: 535 Incorrect authentication data 2018-07-03 07:42:04 SMTP Error: Could not authenticate. 2018-07-03 07:42:04 CLIENT -> SERVER: QUIT 2018-07-03 07:42:04 SERVER -> CLIENT: 221 sg2plcpnl0207.prod.sin2.secureserver.net closing connection 2018-07-03 07:42:04 SMTP connect() failed

@Synchro
Copy link
Member

Synchro commented Jul 3, 2018

I'm guessing that's your own server's internal name, so it's probably the same as using localhost. You could try disabling auth. Either way, this is a GoDaddy support question.

@aks30498
Copy link
Author

aks30498 commented Jul 3, 2018

@Synchro m a newbie to this... and godaddy support is stupid, i mean nothing worked from there.... can you help in any way or i have to post in their forum ?

@aks30498
Copy link
Author

aks30498 commented Jul 3, 2018

@Synchro Setting auth to false worked... still is it good? i mean is it ok if authentication remains disabled?

@Synchro
Copy link
Member

Synchro commented Jul 3, 2018

It's just that if you're sending from your own machine back to itself, then auth isn't gaining you any extra security, and although the server advertises auth, it's probably not set up with the users and passwords you expect. This kind of setup is common in shared hosting. GoDaddy is pretty much the bottom of the barrel as far as hosting goes - you can get a whole server to yourself at scaleway.com for €3/month, though that comes with more responsibility as well as capabilty.

@donkeysmell
Copy link

Im having issues with godaddy,, trying to get this contact form working, works great on local, but not godaddy server

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class Default2 : System.Web.UI.Page
{

protected void btnSubmit_Click(object sender, EventArgs e)
{
    try
    {
        MailMessage Msg = new MailMessage();
        // Sender e-mail address.
        Msg.From = new MailAddress(txtEmail.Text);
        // Recipient e-mail address.
        Msg.To.Add("email@domain.ca");
        Msg.Subject = txtSubject.Text;
        Msg.Body = txtMessage.Text;
        // your remote SMTP server IP.
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtpout.secureserver.net";
        smtp.Port = 587;
        smtp.Credentials = new System.Net.NetworkCredential("email@domain.ca", "password");
        smtp.EnableSsl = true;
        smtp.Send(Msg);
        //Msg = null;
        lbltxt.Text = "Thanks for Contact us";
        // Clear the textbox valuess
        txtName.Text = "";
        txtSubject.Text = "";
        txtMessage.Text = "";
        txtEmail.Text = "";
    }
    catch (Exception ex)
    {
        Console.WriteLine("{0} Exception caught.", ex);
    }
}

}

@Synchro
Copy link
Member

Synchro commented Feb 22, 2020

@donkeysmell Your code isn't even using PHP, let alone PHPMailer!

@tanushree57
Copy link

tanushree57 commented Feb 26, 2020

Hi Marcus @Synchro

I'm having issues with Godaddy and PHPMailer
I've been trying to get this contact form to work which works fine on localhost, but not on the server :/

$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = "smtpout.secureserver.net";
$mail->Username = "email@domainname.com"; // SMTP account username
$mail->Password = "password"; // SMTP account password
$mail->SMTPSecure = 'tls';
$mail->Port = 587;

$mail->setFrom($sender_email, $sender_name);

I get a 500 internal server error (which is pretty useless) without any other information even though I have SMTPdebug is set to 3.
I would be grateful if you could help me out.
Thanks

@NiklasBr
Copy link
Contributor

@tanushree57 what does your error logs say?

Godaddy: Setup PHP error logging

@tanushree57
Copy link

Is this what you're looking for?

2020-02-26 11:43:26 Connection: opening to smtpout.secureserver.net:587, timeout=300, options=array()
2020-02-26 11:43:42 Connection failed. Error #2: stream_socket_client(): unable to connect to smtpout.secureserver.net:587 (Connection refused) [/home/eeidmfu2zbru/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 321]
2020-02-26 11:43:42 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
2020-02-26 11:43:42 Connection: opening to smtpout.secureserver.net:587, timeout=300, options=array()
2020-02-26 11:43:48 Connection failed. Error #2: stream_socket_client(): unable to connect to smtpout.secureserver.net:587 (Connection refused) [/home/eeidmfu2zbru/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 321]
2020-02-26 11:43:48 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

@NiklasBr
Copy link
Contributor

NiklasBr commented Feb 26, 2020

Yes, this is what you should look for:

unable to connect to smtpout.secureserver.net:587 (Connection refused)
SMTP ERROR: Failed to connect to server: Connection refused (111)

The server smtpout.secureserver.net (or something in-between such as Godaddy) won't let you connect to it.

@Synchro
Copy link
Member

Synchro commented Feb 26, 2020

As far as I'm aware, GoDaddy's outbound mail servers use neither encryption nor authentication, and trying to use either will cause it to fail, so I'd recommend turning both of those off and switching to port 25.

@tanushree57
Copy link

Ohh got it. I found the PHPMailer troubleshooting docs and tried the bit of code that you'll have provided under Godaddy. So now it's using localhost at port 25 without either safety measure (the stupidity!). And I think I've got it working now. Thank you so much @NiklasBr & @Synchro !

Btw just a query regarding this way of handling it, isn't it less secure considering the username and password aren't taken into account?

@Synchro
Copy link
Member

Synchro commented Feb 26, 2020

Well, I can understand their reasoning to some extent. They know exactly who you are from your source IP, so can use that for authentication. The traffic is only exposed on the local network, so it's only visible to local users (which might include other GoDaddy users, though even that may be protected by other means), so encryption isn't strictly needed. Combining the two makes things less complicated for them, but as you say, if I wanted to keep things secure I would not be hosting on GoDaddy anyway... :)

@tanushree57
Copy link

tanushree57 commented Feb 26, 2020

Oh yes, I've realised that recently and switched to Bluehost for others but this is a long-standing client who already has his hosting there for sometime so it needed a fix. Godaddy has been nothing but a hassle in the email department every time I've used it.

Merci beaucoup quand même

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants