I want to dynamically create EML files and send them to the client, which would open Outlook (corporate network thus Outlook will be present).
So far, Outlook will open, but the entire $test
string will be featured in the body and will not populate the subject.
I'm probably missing something in the formatting of the string for it to be interpreted correctly by Outlook?
$test = 'MIME-Version: 1.0
Subject: EMAIL_SUBJECT
Content-Type: multipart/mixed; boundary="080107000800000609090108"
This is a message with multiple parts in MIME format.
--080107000800000609090108
Content-Type: text/html
EMAIL_BODY
--080107000800000609090108';
// send to browser
header('Content-Description: File Transfer');
// handled by default e-mail client
header('Content-Type: message/rfc822');
header('Content-Disposition: inline; filename="template.eml"');
header('Cache-Control: private');
echo $test;
exit;
Edit #1
Sample that works as intended. Plus, found a ton of examples here: https://github.com/mikel/mail/tree/master/spec/fixtures/emails/plain_emails
$test = 'MIME-Version: 1.0
Subject: Testing, 1 2 and 3
Content-Type: text/html
Content here
';
// send to browser
header('Content-Description: File Transfer');
// handled by default e-mail client
header('Content-Type: message/rfc822');
header('Content-Disposition: inline; filename="template.eml"');
header('Cache-Control: private');
echo $test;
exit;