I am storing a pdf or text file in mysql blob object, and I am trying to send that as a attachment in the mail using php mailer.
I am sending the mail like .
$mail->AddAddress($pr_email);
$mail->Subject = "Meeting Invitation -$meeting_name";
$mail->AddStringAttachment($data);
$mail->IsHTML(true);
$mail->Body =$message;
if(!$mail->Send())
{
$message= "Error sending: " . $mail->ErrorInfo;
header("Location:userprofile.php?Message={$message}");
}
Where $data
came from
$tmpName = $_FILES['image']['tmp_name'];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);
fclose($fp);
$query = "UPDATE demo_meeting SET attachment='$data' where meetingID='$mtngid'";
$results = mysql_query($query);
Now I am receiving the mail as an attachment but content is not there, it is only showing 0K
.
Please tell me what I might be doing wrong.