I've been researching for 3 weeks now on how to configure SMTP using PHPMailer for GoDaddy but none of it works. Tried contacting the GoDaddy support but they haven't replied yet. And I haven't seen any documentation on how to setup SMTP on their server.
I've been changing the Host many times, tested them, but none of it were successful in sending the email. I surpassed the error (using PHPMailer debug) but when I checked the email, I couldn't see any messages being received.
These are the hosts I've tried:
$mail->Host = "smtp.office365.com";
$mail->Host = "smtpout.secureserver.net";
$mail->Host = "relay-hosting.secureserver.net";
$mail->Host = "localhost";
Also, I've tried the settings in PHPMailer troubleshooting, but it won't work.
$mail->isSMTP();
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
My current settings are:
$mail->isSMTP();
$mail->Host = "smtpout.secureserver.net";
$mail->Port = 80;
$mail->SMTPAuth = true;
//Enable SMTP debugging.
$mail->SMTPDebug = 4;
//Provide username and password
$mail->Username = "email#email.com";
$mail->Password = "password";
$mail->From = "email#email.com";
$mail->FromName = "From Name";
$mail->addAddress("email#email.com", "Name");
The email being used is the email created in GoDaddy which is Office 365 Email Essentials. Under Email & Office (Not Workspace Email or from cPanel). I'm using Economy Linux Hosting with cPanel package.
I'm new to GoDaddy so this problem is new to me. In some hosting providers like InMotion, I've never encountered this problem.
Godaddy made few changes the server relay setting. we don't need to separately mention the relay server settings anymore. following changes will works fine with PHPMailer.
$mail = new PHPMailer;
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->ssl = false;
$mail->authentication = false;
Related
Please tell me how to make the phpmailer module work for siteground hosting?
I noticed that if I comment or remove $mail->isSMTP(); this line, sending mail starts working. But this breaks the logic of my code, because I cannot display success message
Also works if i replace $mail->isMail(); instead of $mail->isSMTP();
Does this mean that SMTP is blocked by the hosting?
My PHPMailer SMTP Config is:
<?php
MAIL_FROM = 'MAIL_ACC_CREATED_ON_SITEGROUND.com',
MAIL_SMTP_HOST = 'mail.mydomain.com',
MAIL_SMTP_PORT = 465;
MAIL_SMTP_USERNAME = 'MAIL_ACC_CREATED_ON_SITEGROUND.com',
MAIL_SMTP_PASSWORD = 'password';
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = MAIL_SMTP_HOST;
$mail->Port = MAIL_SMTP_PORT;
$mail->Username = MAIL_SMTP_USERNAME;
$mail->Password = MAIL_SMTP_PASSWORD;
$mail->SMTPSecure = 'ssl';
I would be grateful for any tip and help!
I don't know how, but I fixed this problem. The problem was my code, not the hosting.
I have site i have created contact us page i want to send mail in users. i have makes the php mailer code but hen ever i submit the contact us button the issue is coming like this(SMTP Error: Could not connect to SMTP host.) please help what is i did wrong.
My PHP mailer code:
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtpout.secureserver.net";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "what is the username";
$mail->Password = "what is the password";
$mail->setFrom('mail#sell.com', 'Raja');
$mail->addAddress($email , $name);
$mail->isHTML(true);
$mail->send();
You're using GoDaddy
You're using encryption, which GoDaddy doesn't support
You're using authentication, which GoDaddy doesn't support
You've disabled debug output so you have no feedback on what's going on, though you won't get much when using ssl mode to port 465 if the server doesn't support it
You have no error checking, so you have no idea where it's breaking - base your code on the examples provided with PHPMailer.
You're using an old version of PHPMailer; get the latest
You've not read what the PHPMailer troubleshooting guide says about GoDaddy
You didn't search before you posted
I have hosted my website on Plesk Hosting and was working on submitting the contact form.
Installed PHP Mailer using composer.
First
I tried to send email using Gmail SMPT server
it worked fine
Second
I tried to send email using my webhosting SMTP Server
it is not working for me
$mail->Host = 'webmail.abc.in'; //host
$mail->SMTPAuth = false;
$mail->Username = '******#abc.in';
$mail->Password = '*******';
$mail->SMTPSecure = 'tls';
$mail->Port = 25;
I tested the SMPT server using SMTPER . it could send email using same credentials.
i dont know where the issue is..
is there any other library other then phpmailer??
This is a example of of code I'm using with gmail. Tested it with webhosting SMTP and worked as well.
` $mailMsg = ADD_MAIL_MESSAGE_HERE;
$mailto = ADD_TO_ADDRESS_HERE;
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Username = ADD_USERNAME_HERE;
$mail->Password = ADD_PASSWORD_HERE;
$mail->SetFrom(ADD_FROM_ADDRESS_HERE);
//-------------------------------------------
$mail->Subject = ADD_MAIL_SUBJECT_HERE;
$mail->Body = $mailMsg;
$mail->AddAddress($mailto);
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
`
$mail->SMTPAuth = true;
As simple as that, I think.
You said you have tested the credentials on SMTPer,
I'm sure you checked the "Use authentication" checkbox.
Maybe you thought you could make it false because you are not using SSL,
But this is about user authentication, not about encrypted communication.
Are you using a Shared Hosting with Plesk? If yes, then this can probably be a port block issue (exact reason you will get only in the maillog). Looking at your code, I can see that in case of your local SMTP testing you are using port 25 while in case of Gmail it's 465.
By default, most of the shared hosting providers block the outgoing SMTP connection on port 25. This is done in order to protect the network and infrastructure from Spamming. If this is the case, then you need to contact their support to unblock the port or use some port free mode of email sending. Means instead of connecting over SMTP, connect over HTTP API for sending emails.
When I send a request to this, the request times out. This code has worked on another script in the same directory. I just logged into the gmail via browser to make sure all was good. The logged value of $mail->ErrorInfo is: SMTP connect() failed.
Any idea why this might work back in November but now throws an error when I copy it to another script?
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->CharSet = 'UTF-8';
$mail->Debugoutput = 'html';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Username = "xxxxxx#gmail.com";
$mail->Password = "xxxxxxxxxx";
$mail->setFrom('xxxxxxxxxxx#gmail.com', 'xxxxxxxx');
$mail->addReplyTo('xxxxx#gmail.com', 'xxxxxx');
$mail->addAddress($email, $name);
$mail->Subject = 'Your License Information';
$mail->Body = $message;
I tried another gmail account and I've tried using the app password Gmail gives you.
Since I had it working before in same directory with similar code, I knew it had to be something weird. I tried ping google.com which didn't work and got me thinking about outbound traffic. Then I did ping 24.156.131.93 which is Google's IP (cutting out the domain resolver) and that worked, so I changed my nameservers in resolv.conf to Google's 8.8.8.8 and it now works. So basically, my host has some issues with their nameservers they provided, and the error wasn't just for SMTP but outgoing traffic is a whole.
This is what I get when running the PHPMailer script on the production server. PHPMailer version is 5.1
SMTP -> ERROR: Failed to connect to server: Network is unreachable (101)
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error:
Could not connect to SMTP host
PHPMailer Configuration
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "xxxx#gmail.com";
$mail->Password = "xxxx";
Using this config, it worked perfectly on localhost running XAMPP.
What I Tried
$mail->SMTPSecure = "tls"; // no luck
$mail->Host = "ssl://smtp.gmail.com"; // no luck
$mail->SMTPKeepAlive = true; // no luck
$mail->Port = 587; // no luck
$mail->Port = 25; // no luck
I tried with various combinations of the above but still I got the error message displayed above.
FYI, my localhost is on Windows while the server is on Linux. Don't know if that would cause a problem, but just wanted to put it out there.