Some question's, and articles I've been reading regarding EML creation
- How to verify DKIM signature from an e-mail with openssl?
- PHP library to generate EML email files?
- https://www.icosaedro.it/phplint/mailer-tutorial/index.html
- https://coderedirect.com/questions/25620/php-library-to-generate-eml-email-files (This one is interesting, but it would need extending for DKIM signatures)
- https://www.example-code.com/phpExt/smtp_loadEmlAndSend.asp (only does SMTP send)
- https://community.apachefriends.org/f/viewtopic.php?t=79968&p=270281 (this works great for Linux, haven't been able to find Windows equivalent)
- Use of mailtodisk / mailoutput in XAMPP for Linux (Great concept)
- https://swiftmailer.symfony.com/docs/introduction.html (This is from Symfony yet to see if works without Symfony but no longer maintained)
I can't seem to find any standalone class
files that will generate the contents for *.eml
that can be either stored into file (using file_put_contents
) or temporarily into a variable
.
The idea is that I can create my *.eml
file server-side I could use the contents to verify a DKIM signature, without having to actually send an email
.
I did find one library phplint that does what I want, but it is far too big for what I need (635 Files, 53 Folders 7.84 MB (8,224,768 bytes)
).
$m = new Mailer();
$m->setSubject("This is the subject");
$m->setFrom("[email protected]", "My Name");
$m->addAddress("[email protected]", "Your Name");
$m->setTextMessage("This is the text body of the message.");
$m->sendByStream($out_string, TRUE);
$message_as_string = $out_string->__toString();
The above snippet uses the following classes
to generate the message.
[180] => it\icosaedro\email\Mailer
[181] => it\icosaedro\io\IOException
[182] => it\icosaedro\utils\StringBuffer
[183] => it\icosaedro\io\OutputStream
[184] => it\icosaedro\io\StringOutputStream
[185] => it\icosaedro\email\Field
[186] => it\icosaedro\email\MIMEAbstractPart
[187] => it\icosaedro\email\Header
[188] => it\icosaedro\email\MIMEPartMemory
[189] => it\icosaedro\email\EOLFilter
[190] => it\icosaedro\utils\Random
I've been looking all over github, as well as PHPClasses. But I can't anything relevant to what I need (with enough research I could probably build it myself but I'd prefer not to reinvent the wheel).
Ideally I'm looking for possibly an extension of PHPMailer, that can stream the EMAIL either to File or String Variable). I also need the class
or function
to work on both linux
and windows
.
If somebody can just find a library or point me into the right direction, I'd much appreciate it.