Archive for May 2019

Sending email in Magento with attachment

$mail = new Zend_Mail(); $mail->setType(Zend_Mime::MULTIPART_RELATED); $mail->setBodyHtml('<p>This is Magento email sample with attachment</p>’); $mail->setFrom("sender@senderemail.com", "Sender title"); $mail->addTo(["recepient@recepientemail.com"]); $mail->setSubject("Email Subject"); $file = $mail->createAttachment(file_get_contents("/file/path/to/attachment.csv")); $file->type = ‘text/csv’; $file->disposition = Zend_Mime::DISPOSITION_INLINE; $file->encoding = Zend_Mime::ENCODING_BASE64; $file->filename = basename("/file/path/to/attachment.csv"); $mail->send();

Using {{widget}} tag in phtml same as in CMS Editor

$filter = new Mage_Widget_Model_Template_Filter(); $_widget = $filter->filter('{{widget type="cms/widget_page_link" template="cms/widget/link/link_block.phtml" page_id="2"}}’); echo $_widget;