cancel
Showing results for 
Search instead for 
Did you mean: 

Reinstate method addAttachment($pdfString,$filename) to add CSV attachment in email.

0 Kudos

Reinstate method addAttachment($pdfString,$filename) to add CSV attachment in email.

In Magento 2.2, we used to use addAttachment($pdfString,$filename) to add CSV attachment in email.
File Path: \Magento\Framework\Mail\Template\TransportBuilder
But, In Magento 2.3.1 this method is deprecated.

There is no documented way to replace this functionality. 

 

Below are the links which have been suggested. We tried but it did not work.

1)https://magento.stackexchange.com/questions/252506/magento-2-3-custom-email-attachment-not-working

Comments:We tried addAttachment($pdfString,$filename) function but addAttachment() is deprecated in Magento 2.3.1

2)https://docs.zendframework.com/zend-mail/message/attachments/

Comments:We have used Zend\Mail\Transport\Smtp as SmtpTransport to send email from our portal.
Email was triggered with CSV Attachment but first email was triggered 3 hours after executing cron and then every email has 1 hour delay in between

3)https://meetanshi.com/blog/add-attachments-with-email-in-magento-2-3-x/

Comments:We tried with this solution but in transportbuilder file below mentioned files are not available in magento 2.3 framework Mail folder
use Magento\Framework\Mail\MimeInterface;
use Magento\Framework\Mail\MimeMessageInterfaceFactory;
use Magento\Framework\Mail\MimePartInterfaceFactory;

4)https://extait.com/blog/how-to-send-email-with-attachment-in-magento-2-3/

Comments: we implemented this solution but emails are not getting triggered.