I face one issue with createAttachment method. This method attached pdf but pdf not open and its size is zero kb.
$html .= "
<html>
<head>
</head>
<body>
Test pdf
</body>
</html>";
$attachment = $emailTemp->getMail()->createAttachment($html);
$attachment->type = 'application/pdf';
$attachment->filename = 'test.pdf';
$attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$attachment->encoding = Zend_Mime::ENCODING_BASE64;
$emailTemp->send($useremail,$Username,$emailTempVariables);
Please help me ASAP. what is wrong here?
I want to attached pdf with custom HTML in magento.
Best Answer
First you have to create a pdf file, You can create pdf file using below code, suggested code is just for create sample pdf file. you can change it as per your requirement.
After generating PDF file, try with your attachment code with proper PDF file which you have created.