phpmailer - Php mailer body is empty


Iam using PHP mailer to send an Email the message sent but email body is Empty

here is my code

foreach($results as $result)

    $email = $result['email'];

    $body = 'Hello'.$result['username'].' we remind you to return the book to library after' .$result['days'];

    $mail = new PHPMailer; 
    $mail->Host = ';'; 
    $mail->SMTPAuth = true;
    $mail->Username = '[email protected]';
    $mail->Password = 'mypassword';
    $mail->SMTPSecure = 'ssl';
    $mail->Port = 465;

    $mail->From = '[email protected]'; 
    $mail->FromName ='Bookstore'; 
    $mail->addAddress($email, 'username');
    $mail->Subject = 'Book returned Time'; 
    $mail->Body = $body; 

    if(!$mail->send()) { 
        echo 'Message could not be sent.'; 
        //echo 'Mailer Error: ' . $mail->ErrorInfo; return $user ; 
    } else { 
        echo 'done'; 


People are also looking for solutions to the problem: command line - php prevent '`rm -rf ~/`;'


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.