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.
- 
 Which error you are facing?Dhiren Vasoya– Dhiren Vasoya2021年03月26日 14:12:45 +00:00Commented Mar 26, 2021 at 14:12
 - 
 try this magento.stackexchange.com/a/298001/82670Msquare– Msquare2021年03月27日 09:43:14 +00:00Commented Mar 27, 2021 at 9:43
 - 
 And also try this magento.stackexchange.com/questions/252506/…Msquare– Msquare2021年03月27日 09:44:21 +00:00Commented Mar 27, 2021 at 9:44
 
1 Answer 1
This worked for me!
$this->message->createAttachment(
 $pdfString,
 \Zend_Mime::TYPE_OCTETSTREAM,
 \Zend_Mime::DISPOSITION_ATTACHMENT,
 \Zend_Mime::ENCODING_BASE64,
 'attatched.pdf'
 );
 Explore related questions
See similar questions with these tags.