If you use Email Connector module, it would be so much easier. A new module used instead of email template module, In there it has SUB_EmailMessage_SetAttachment microflow. Easy to set attachments with that.
You may check documentation:
https://docs.mendix.com/appstore/connectors/email-connector/