How to use phpmailer for email firing? Error: Message body empty

0

I'm having trouble executing the email trigger via PHPMailer, the following error is being generated: Mailer Error: Message body empty

Follow my code:

<?php

require 'PHPMailer/class.smtp.php';
require 'PHPMailer/class.phpmailer.php';

$Mailer = new PHPMailer;

$Mailer->isSMTP();

$Mailer->isHTML(true);

$Mailer->CharSet = "UTF-8";

$Mailer->SMTPAuth = true;

$Mailer->SMTPDebug = 3;

$Mailer->SMTPSecure = "ssl";

$Mailer->Host = "meu.host.com";

$Mailer->Username = "[email protected]";

$Mailer->Password = "minha_senha_do_email";

$Mailer->Port = 587;

$Mailer->FormName = "ffffffff";

$Mailer->Form = "[email protected]";

$Mailer->addAddress("[email protected]");


$Mailer->Subject = "dddddddd";

$Mailer->body = "fffffffffffffffffffffff";


if (!$Mailer->send()) {
    echo "Mailer Error: " . $Mailer->ErrorInfo;
} else {
    echo "Message sent!";
}

?>
    
asked by anonymous 11.09.2018 / 06:26

1 answer

1

Your issue with this line:

$Mailer ->body = 'fffffffffffffffffffffff';

Change to "Body":

$Mailer->Body = 'fffffffffffffffffffffff';

If you still have problems with addAddress try to change

$Mailer -> addAddress('o seu email');

For "AddAddress"

$Mailer->AddAddress ('O seu email', 'nome');
    
11.09.2018 / 09:38