0

I have this PHPMailer that sends out an email to me if a script has run.

I want to add some array values to the mailcontent but it seems to fail.
When I did my mailing through the mail() function and that worked.

Here is what I have:

$mail = new PHPMailer();
$mail->IsSMTP();                                                    
$mail->Host = 'www.domain.com';                 
$mail->Port = 465;                                              
$mail->SMTPAuth = true;                                         
$mail->Username = "usernamen.nl";    
$mail->Password = "password";                           
$mail->SMTPSecure = 'ssl';                                      

$mail->From = '[email protected]';
$mail->FromName = 'Import Users';
$mail->AddAddress('[email protected]', 'CronJob results'); 

$mail->IsHTML(true);                                                

$mail->Subject = 'CronJob results';
$mail->Body    = 'Updated users'.implode($update, "<br />").'

                Added users'.implode($add, "<br />").'

                Deleted users'.implode($delete, "<br />").'
                                                ';

if(!$mail->Send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
    exit;
}

$update, $add and $delete are the array that are filled with their corresponding data.

M.

1 Answer 1

2

you are making a small mistake in implode. you should use implode like this

implode( "<br />",$add);
Sign up to request clarification or add additional context in comments.

2 Comments

You just saved me a lot of time. Thank you!
waah. @syedmohamed. Aaj.. sab jagah aapka he answer hain. Umda. Behatrin. Zindabad.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.