Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Mailer Attachments

edited June 2012 in Framework

Any docs on how to properly attach a PDF or anything for that matter with the sender? I worked with it for awhile and the only way I could get anything attachment wise to send was to just directly use the new Zend_Mime_Part directly in the attachments portion of the mailer. Tried building the attachment outside of that and nothing worked.


  • I believe you do have to create a Zend_Mime_Part object and pass that in the 'attachments' array in order for it to work.

  • edited June 2012

    I dunno. I figure it out after a million different iterations. I just scrapped everything and went straight to the zend mail.

    $mail = Mailer::getInstance ();
    $mail->setBodyText('Body Text Here');
    $mail->setFrom('', 'Sender');
    $mail->addTo('', 'Recipient');
    $mail->setSubject('Subject Goes Here');
    $filecontents = file_get_contents('cache/order_19.pdf');
    $att = $mail->createAttachment($filecontents);
    $att->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
    $att->encoding = Zend_Mime::ENCODING_BASE64;
    $att->filename = 'order_19.pdf';
    $att->type = 'application/pdf';
Sign In or Register to comment.