0
would like to identify a problem in the following code:
try {
$mail = new PHPMailer(true);
$this->setLanguage("br");
$this->isSMTP();
$this->SMTPDebug = 4;
$this->SMTPAuth = true;
$this->SMTPSecure = 'ssl';
$this->Host = 'hostname';
$this->Port = 465;
$this->CharSet = 'utf-8';
$mail->setFrom('[email protected]', 'John Doe');
$mail->Subject = "Um e-mail qualquer";
$mail->addAddress('[email protected]');
$mail->isHTML(true);
$mail->body = "teste";
$mail->send();
$_SESSION['email_enviado'] = true;
} catch (Exception $e) {
$_SESSION['email_enviado'] = false;
$_SESSION['descricao_erro'] = $mail->ErrorInfo;
}
Well, this email is not being sent, and I can’t see the problem because my SMTP even being at level 4 does not return me anything.
I would like to view only the problem according to SMTP debug.
PS: I omitted for security reasons the username/password of the host, from the account the email will be sent..
put $this->Smtpdebug = 1;
– user148170
I did not reproduce your problem, I can see the Debug data, in my scenario I used your code by changing only $this->Smtpsecure to tls and $this->Port to 587. However I noticed that $mail->body should be $mail->Body, otherwise the email will not be sent due to lack of data in the body of the email.
– Oliveira
That was exactly the problem. Wow.. And I received no error!!
– Haryel Ramalho