2
I’m trying to send the email via localhost by codeiginiter. Inside my Ibraries folder, I created a "Phpmailer" folder to put the Phpmailer file. Not sending the email, is giving the following error:
2015-09-24 16:53:47 CLIENT -> SERVER: EHLO localhost 2015-09-24 16:53:47 CLIENT -> SERVER: AUTH LOGIN 2015-09-24 16:53:47 CLIENT -> SERVER: bWF0aGV1c3Zvc2FAZ21haWwuY29t 2015-09-24 16:53:48 CLIENT -> SERVER: R0BNQC5FbGVj 2015-09-24 16:53:49 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 f19sm4787092qhc.18 - gsmtp 2015-09-24 16:53:49 SMTP Error: Could not authenticate. 2015-09-24 16:53:49 CLIENT -> SERVER: QUIT 2015-09-24 16:53:50 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
When I change the door to 587, the following error:
2015-09-24 17:30:49 SMTP ERROR: Failed to connect to server: (0) 2015-09-24 17:30:49 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I downloaded the Phpmailer files on Github of the project. I looked for other tutorials and saw that some said I had to uncomment a line on php.ini. This one’s already been discolored: extension=php_openssl.dll
.
I checked some tutorials as well (this and this, for example) to see what he was really doing wrong. But nothing works.
I don’t know if you can add it either, but I’m using the Wamp at gate 8080, because I’ve got the IIS running at gate 80.
My code is here, for those who need more information:
//Minha lib
class My_email {
function __construct(){
require_once('PHPMailer/class.phpmailer.php');
require_once('PHPMailer/class.smtp.php');
require_once('PHPMailer/PHPMailerAutoLoad.php');
require_once('PHPMailer/class.phpmaileroauthgoogle.php');
require_once('PHPMailer/class.phpmaileroauth.php');
}
}
//Meu controller
class email extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->library('My_email');
}
function enviaEmail(){
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->IsHTML(true);
$mail->Username = "[email protected]";
$mail->Password = "minhasenha";
$mail->SetFrom('[email protected]', 'Remetente');
$mail->AddReplyTo("[email protected]","Nome Completo");
$mail->Subject = "Assunto";
$mail->Body = "Corpo do e-mail em HTML.<br />";
$mail->AltBody = "Corpo em texto puro.";
$destino = "[email protected]";
$mail->AddAddress($destino, "Pessoa Lopes Leite");
if(!$mail->Send()) {
echo $mail->ErrorInfo;
} else {
echo "Mensagem enviada com sucesso!";
}
}
}
Thanks for your attention and help :)
The error said that authentication failed ..., it may be the wrong password, wrong port etc.
– rray
@rray I made an edition there, give a look please...
– Matheus Velloso
I’m in the same trouble you are, I uninstalled Xampp, I released port 80 from IIS, I installed Xampp again. I restarted the machine and it worked, sent about 5 emails, until the moment it stopped and I’m having the same problem again! Following the topic here!
– JamesOrtiz