I am sending a pdf file as attachment using PHPMailer, which is generated using mpdf.
But on receiving the mail the attachment is not opening and it is showing the error that "Adobe reader cannot open the file because the file is either damaged or not a supported type". Also saying that the attachment wasn't correctly decoded.
The code I used to upload the file is
$string = file_get_contents("url?var1&var2");
$binary_content = file_get_contents($string);
$emailobj->AddStringAttachment($binary_content, "invoice.pdf", $encoding = 'base64', $type = 'application/octet-stream');""
Note: I don't want the file to be uploaded to the server.
Please provide any solution for this.