1

I am using Magento version 2.2.6 and trying to send custom email with attachment, but I am getting 500 error. I tried transportbuilder addattachment which is working in Magento 2.3.x and onwards. But facing issue in this version.

I am trying this code:

 $this->message->createAttachment(
 $pdfString,
 'application/pdf',
 \Zend_Mime::DISPOSITION_ATTACHMENT,
 \Zend_Mime::ENCODING_BASE64,
 'attatched.pdf'
 );

And getting this error [1]: https://i.sstatic.net/civfS.png

Kindly let me know how I can send email with attachment in Magento version 2.2.6.

Any help will be apperciated.

asked Mar 26, 2021 at 14:12
3

1 Answer 1

0

This worked for me!

$this->message->createAttachment(
 $pdfString,
 \Zend_Mime::TYPE_OCTETSTREAM,
 \Zend_Mime::DISPOSITION_ATTACHMENT,
 \Zend_Mime::ENCODING_BASE64,
 'attatched.pdf'
 );
answered Nov 19, 2021 at 10:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.