关于EML创作的一些问题,以及我一直在读的文章
我似乎找不到任何独立的class文件来生成*.eml的内容,这些内容既可以存储到文件中(使用file_put_contents),也可以临时存储到variable中。
我的想法是,我可以创建我的*.eml文件服务器端,我可以使用内容来验证DKIM签名,而不必实际发送email。
我确实找到了一个库夹板,它可以做我想做的事情,但是它太大了,无法满足我的需要(635 Files, 53 Folders 7.84 MB (8,224,768 bytes))。
$m = new Mailer();
$m->setSubject("This is the subject");
$m->setFrom("my@mydomain.com", "My Name");
$m->addAddress("you@yourdomain.com", "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的一个扩展,它可以将电子邮件流到File或String变量)。我还需要class或function来处理linux和windows。
如果有人能找到一个图书馆或者把我引向正确的方向,我会非常感激的。
发布于 2021-11-26 08:21:46
我想我找到了我和https://symfony.com/doc/current/mailer.html一起寻找的东西
$email = (new Email())
->from('hello@example.com')
->to('you@example.com')
//->cc('cc@example.com')
//->bcc('bcc@example.com')
//->replyTo('fabien@example.com')
//->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://stackoverflow.com/questions/70120578
复制相似问题