I'm trying to send mails from my CodeIgniter webpage with PHPMailer. In fact, my code worked perfectly in localhost but when I uploaded it to the server (whose name's 260mb), I got this error message:
SMTP -> ERROR: Password not accepted from server: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 SMTP -> ERROR: MAIL not accepted from server: 530-5.5.1 Authentication Required.
These are the most important lines of my code (I don't write the other because they work well on localhost):
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = 'myemail@gmail.com';
$mail->Password = 'password_of_myemail@gmail.com';
$mail->From = 'myemail@gmail.com';
$mail->FromName = 'John';
$mail->AddAddress('otheremail@gmail.com');
After this, I tried to create two email accounts on my server, one of them for sending the message and the other to receive it. The changes I made on my code are these:
$mail->Host = 'localhost'; //Because both email accounts are on the server;
$mail->Port = 25;
$mail->Username = 'phpmailerfrom@mydomain.260mb.net';
$mail->Password = 'password_of_phpmailerfrom@mydomain.260mb.net';
$mail->From = 'phpmailerfrom@mydomain.260mb.net';
$mail->FromName = 'John';
$mail->AddAddress('phpmailerto@mydomain.260mb.net');
But in this case the errors are:
SMTP -> ERROR: Failed to connect to server: Connection refused (111) The following From address failed: phpmailerfrom@mydomain.260mb.net
I would appreciate a lot any help, especially if you could solve the first situation. I looked for a lot of information and may be the problem is the free server, in that case, how can I authorize mails in 260mb cPanel??
Thank you.