I want to send attachment with newsletter in magento, I want to find, which file is using for sending newsletter email. I tried with this file /app/code/local/Mage/Newsletter/Model/Subscriber.php and add attachment code sendConfirmationRequestEmail in this function, but its not a write file. Can any one help ?

1 Answer 1


I found file in which I need to make change, its /app/code/local/Mage/Newsletter/Model/Queue.php and I just added code in sendPerSubscriber() function inside foreach loop

        foreach($collection->getItems() as $item) {
        $email = $item->getSubscriberEmail();
        $name = $item->getSubscriberFullName();


        //sending file as attachment code start

            $fileName="PSB_ONLINE.pdf";//file to be attach                                          
            $attachmentFilePath = Mage::getBaseDir('media'). DS . $fileName;
                $fileContents = file_get_contents($attachmentFilePath);                    
                $attachment   = $sender->getMail()->createAttachment($fileContents);
                $attachment->type = 'application/pdf';
                $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
                $attachment->encoding = Zend_Mime::ENCODING_BASE64;                 
                $attachment->filename = $fileName;
     //sending file as attachment end

        $successSend = $sender->send($email, $name, array('subscriber' => $item));

        if($successSend) {
        } else {
            $problem = Mage::getModel('newsletter/problem');
            $notification = Mage::helper('newsletter')->__('Please refer to exeption.log');
                ->addErrorData(new Exception($notification))
  • can you please accept your own question. Please do it friend. Nov 8, 2014 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.