Jump to content
acao

[Resolvido] erro em envio de e-mail com class phpmailer

Recommended Posts

acao

boas

tenho este erro ao enviar e-mail com a classe phpmailer.

em localhost esta a funcionar bem.

erro:

SMTP -> FROM SERVER:220 mx.google.com ESMTP a67sm46306127yhj.10 - gsmtp

SMTP -> FROM SERVER: 250-mx.google.com at your service, [31.170.166.30] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN 250-ENHANCEDSTATUSCODES 250 CHUNKING

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 Learn more at https://support.google.com/mail/bin/answer.py?answer=787 534 5.7.14 54 a67sm46306127yhj.10 - gsmtp

SMTP -> FROM SERVER:250 2.1.5 Flushed a67sm46306127yhj.10 - gsmtp

SMTP Error: Could not authenticate. erroSMTP Error: Could not authenticate.

agradeço alguma dica.

cod:

<?php
class ClasEmailReg {
private $PHPMailer;
public $EmailRegSucessoTrue;
public $erro;
public function __construct() {
	require 'class.phpmailer.php';
	$this->PHPMailer = new PHPMailer();
}
public function EnviarEmailReg($emailDestino1, $emailDestino2,$assunto,$msg){
	$email1 = $emailDestino1;
	$email2 = $emailDestino2;
	$subject = $assunto;
	$Action = $msg;
	$this->PHPMailer->IsSMTP();

	$this->PHPMailer->isHTML();

	$this->PHPMailer->Charset = 'UTF-8';

	$this->PHPMailer->SMTPAuth = true;
	$this->PHPMailer->SMTPSecure = 'ssl';
	$this->PHPMailer->Host ='smtp.gmail.com';
	$this->PHPMailer->Port = 465;
   // $this->PHPMailer->SMTPDebug=2;

	$this->PHPMailer->Username = "[email="xxxxxxxxxx@gmail.com"]xxxxxxxxxx@gmail.com[/email]";
	$this->PHPMailer->Password = 'xxxxxxxxxxxx';
	$this->PHPMailer->From = "[email="xxxxxxxxxxxxx@gmail.com"]xxxxxxxxxxxxx@gmail.com[/email]";

	$this->PHPMailer->FromName = 'xxxxxxxxxxxxxxx';
	$this->PHPMailer->Subject = utf8_decode($subject);
	$this->PHPMailer->MsgHTML(utf8_decode($Action));
	$this->PHPMailer->AddAddress($email1);
	$this->PHPMailer->AddBCC($email2);

	if ( $this->PHPMailer->Send() )
	{
		$this->EmailRegSucessoTrue = 1;
		//echo "Enviado com sucesso";
	}
	else
	{
		$this->EmailRegSucessoTrue = 0;
		$this->erro = $this->PHPMailer->ErrorInfo;
	}
}
}

cumps

acao

ainda não consegui resolver,

tenho estes dados da hospedagem:

Configurações de e-mail

Para as contas de e-mail que você configure, você deve usar os seguintes detalhes de conexão em seu programa de e-mail:

POP3 Host Address: mx1.3jelly.com

Host SMTP Endereço: mx1.3jelly.com

Nome de usuário: O endereço de e-mail que você está verificando e-mail para

Senha: Conforme especificado ao configurar a conta de e-mail

alguém tem alguma ideia?

não configurei nada na hospedagem , é necessário configurar ?

cumps

acao

Edited by acao

Share this post


Link to post
Share on other sites
acao

boas

penso que estará resolvido:

tirei o envio através de smtp e está a funcionar, espero que não seja sol de pouca dura.

<?php
class ClasEmailReg {
    private $PHPMailer;
    public $EmailRegSucessoTrue;
    public $erro;
    public function __construct() {
		    require 'class.phpmailer.php';
		    $this->PHPMailer = new PHPMailer();
    }
    public function EnviarEmailReg($emailDestino1, $emailDestino2,$assunto,$msg){
		    $email1 = $emailDestino1;
		    $email2 = $emailDestino2;
		    $subject = $assunto;
		    $Action = $msg;
		    $this->PHPMailer->ismail()


		    $this->PHPMailer->isHTML();

		    $this->PHPMailer->Charset = 'UTF-8';

		   // $this->PHPMailer->SMTPAuth = true;
		   // $this->PHPMailer->SMTPSecure = 'ssl';
		   // $this->PHPMailer->Host ='smtp.gmail.com';
		  //  $this->PHPMailer->Port = 465;
	   // $this->PHPMailer->SMTPDebug=2;
		  //  $this->PHPMailer->Username = "xxxxxxxxxx@gmail.com";
		  //  $this->PHPMailer->Password = 'xxxxxxxxxxxx';
		 //   $this->PHPMailer->From = "xxxxxxxxxxxxx@gmail.com";

		    $this->PHPMailer->FromName = 'xxxxxxxxxxxxxxx';
		    $this->PHPMailer->Subject = utf8_decode($subject);
		    $this->PHPMailer->MsgHTML(utf8_decode($Action));
		    $this->PHPMailer->AddAddress($email1);
		    $this->PHPMailer->AddBCC($email2);

		    if ( $this->PHPMailer->Send() )
		    {
				    $this->EmailRegSucessoTrue = 1;
				    //echo "Enviado com sucesso";
		    }
		    else
		    {
				    $this->EmailRegSucessoTrue = 0;
				    $this->erro = $this->PHPMailer->ErrorInfo;
		    }
    }
}

cumps

acao

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.