I tried contacting support from Bluehost but they don't know how to set this up.
What I did is first create my email account(VPS account).
Then get all the details of my email setting.
Email Settings
Mail Server Username: notification@website.co
Standard (without SSL)
Incoming Mail Server: details here
Supported Ports: 143 (IMAP), 110
(POP3) Outgoing Mail Server: details here
Supported Port: 26 (server
requires authentication)
So on my PHPMailer code I added this:
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 26;
$mail->Host = "198.xx.xxx.x";
$mail->Username = 'notification@website.co';
$mail->Password = "myemailpassword";
But I got this error.
SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
SMTP Error: Could not connect to SMTP host.
This is new setup of my SMTP.
Any help? I am new in setting up PHPMailer SMTP.
I know this is different from this problem and this
Mail is a real pain to get right, I would never ever recommend using the built in mail. There are so many things you have to account for when sending mail for instance;
Is the IP where mail is being sent from blacklisted anywhere?
Deliverability, having the mail on the same place as your web server could have catastrophic problems, if your server crashes your mail is at risk.
You're using a shared host so chances are they may not allow sending of mail due to spam restrictions.
Your best bet is to grab a service like Mailgun and use their API and send mail, they have a free tier up to 10,000 emails or so. They handle everything from making sure the headers are correct, they are being sent from a reliable source.
Of course this isn't a direct solution to your problem, maybe you didn't know about services like Mailgun, I would highly recommend researching mail sending of PHP.
Running authenticated SMTP on port 26 without encryption is anything but standard!
They say "Standard (without SSL)", but you've put $mail->SMTPSecure = "ssl";
.
That's unlikely to work because that mode expects implicit SSL (i.e. PHPMailer will starting talking SSL immediately it connects), so do what they say and disable it with $mail->SMTPSecure = '';
- or alternatively don't set it at all since that is the default value.
Check it by setting $mail->SMTPDebug = 3;
It depends on Bluehost servers, sometimes they give you error
ERROR: Failed to connect to server: Connection timed out (110)
SMTP Error: Could not connect to SMTP host.
the other day, they can give you a different error
Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=*.bluehost.com
did not match expected CN=blah-blah.blah.com
[/home/.../vendor/phpmailer/phpmailer/src/SMTP.php line 405]
all of this boils down to Bluehost
wants you to send emails via their exchange server.
It is a bad idea to fight with your service provider, no matter if you find a whole in their config, they will change it one day and you will get in trouble.
Give up and go to a different hosting.