我一直在閱讀有關 EML 創建的一些問題和文章
- 如何使用 openssl 從電子郵件中驗證 DKIM 簽名?
- PHP 庫生成 EML 電子郵件檔案?
- https://www.icosaedro.it/phplint/mailer-tutorial/index.html
- https://coderedirect.com/questions/25620/php-library-to-generate-eml-email-files(這個很有趣,但它需要擴展 DKIM 簽名)
- https://www.example-code.com/phpExt/smtp_loadEmlAndSend.asp(只做SMTP發送)
- https://community.apachefriends.org/f/viewtopic.php?t=79968&p=270281(這對 Linux 非常有用,但無法找到 Windows 等效項)
- 在 XAMPP for Linux 中使用 mailtodisk / mailoutput(很棒的概念)
- https://swiftmailer.symfony.com/docs/introduction.html(這是來自 Symfony 還沒有看到是否可以在沒有 Symfony 的情況下作業但不再維護)
我似乎找不到任何獨立class檔案來生成*.eml可以存盤到檔案(使用file_put_contents)或臨時存盤到variable.
這個想法是我可以創建我的*.eml檔案服務器端我可以使用內容來驗證 DKIM 簽名,而不必實際發送email.
我確實找到了一個phplint庫,它可以滿足我的需求,但它對于我需要的東西來說太大了 ( 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();
上面的代碼片段使用以下內容classes來生成訊息。
[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
我一直在尋找github以及 PHPClasses。但是我不能做任何與我需要的相關的事情(通過足夠的研究,我可能可以自己構建它,但我不想重新發明輪子)。
理想情況下,我正在尋找可能的 PHPMailer 擴展,它可以將 EMAIL 流式傳輸到檔案或字串變數)。我還需要classorfunction來處理linuxand windows。
如果有人能找到圖書館或為我指明正確的方向,我將不勝感激。
uj5u.com熱心網友回復:
我想我已經找到了我一直在尋找的https://symfony.com/doc/current/mailer.html
$email = (new Email())
->from('[email protected]')
->to('[email protected]')
//->cc('[email protected]')
//->bcc('[email protected]')
//->replyTo('[email protected]')
//->priority(Email::PRIORITY_HIGH)
->subject('Time for Symfony Mailer!')
->text('Sending emails is fun again!')
->html('<p>See Twig integration for better HTML integration!</p>');
echo "<pre>";
print_r($email->toString());
echo "</pre>";
盡管我仍在尋找單一類別的解決方案,而不是下載膨脹軟體來完成一項任務。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/372542.html
