I am trying to send an email to a mail list that is on a Mysql database, using PHPMailer. I have looked at several posts on this subject and have tried the suggestions, but it still does not send the attachement.
The file I am trying to attach is called news.pdf and is in a folder called Newsletters, which off the root folder. Here is part of the code where the addattachment command is:
while ($row = mysqli_fetch_array($result)) {
$attach = $row['attachment'];
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->AddBCC($row['email']);
$mail->SetFrom('administrator@1066cards4u.co.uk', 'Tony Hudson');
$mail->Subject = $row['subtxt'];
$mail->MsgHTML($row['message']);
$mail->AddAttachment("/newsletters/".$row['attachment'].".pdf");
}
if(!$mail->Send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Messages sent!';
}
I can't see what I am doing wrong!
Can anybody help me?