Guest User

Untitled

a guest
Mar 21st, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. $mail = new Zend_Mail('utf-8');
  2. $mail->setType(Zend_Mime::MULTIPART_RELATED);
  3. $mail->setBodyHtml($html);
  4. $mail->setFrom('penawaran@mail.id', 'Nekindo');
  5. $mail->addTo('mail@mail.com', 'Syahidah Humairoh');
  6. $mail->setSubject('subject');
  7. try {
  8. $mail->send();
  9. Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
  10. $this->_redirect('offer');
  11. }
  12. catch (Exception $e) {
  13. Mage::getSingleton('core/session')->addError('Unable to send.');
  14. $this->_redirect('offer');
  15. }
  16.  
  17. $pdfName="Penawaran";
  18. $pdf->Output(Mage::getBaseDir().'/media/tmp/'.$pdfName.'.pdf', 'F');
  19. $pdfurl=Mage::getBaseDir().'/media/tmp/'.$pdfName.'.pdf';
  20. $mail->createAttachment(
  21. file_get_contents($pdfurl),
  22. 'application/pdf',
  23. Zend_Mime::DISPOSITION_ATTACHMENT,
  24. Zend_Mime::ENCODING_BASE64,
  25. $pdfName.'.pdf'
  26. );
  27.  
  28. $mail->createAttachment(
  29. Zend_Pdf::load($pdfFilePath)->render(),
  30. 'application/pdf',
  31. Zend_Mime::DISPOSITION_ATTACHMENT,
  32. Zend_Mime::ENCODING_BASE64,
  33. 'My_Custom_Filename.pdf'
  34. );
Add Comment
Please, Sign In to add comment