Attachment name and file extension not working in email *.eml
I want to create email files in .eml format with multiple attachments in. The attachments are generated and the content of the attachments are correct. But the attachments always come in .dat format and the file names go as "ATT00001", "ATT0002".. etc Currently I am following the solution given in this stackoverflow question and my code is as follows PHP foreach($reports as $pdf){ $attachment = file_get_contents("auto_report_attachments\\Template_Attachment.eml"); $attachment = str_replace("TEMPLATE_MIME_TYPE", $pdf['type'], $attachment); $attachment = str_replace("TEMPLATE_FILE_NAME", $pdf[