glastree_on_gitea

This commit is contained in:
2026-05-26 08:14:29 +02:00
commit 0bed099d05
9556 changed files with 1186307 additions and 0 deletions
@@ -0,0 +1,26 @@
<?php
namespace DirectoryTree\ImapEngine\Support;
use DirectoryTree\ImapEngine\BodyStructurePart;
class MimeMessage
{
/**
* Build a minimal MIME message from body structure metadata and raw content.
*/
public static function make(BodyStructurePart $part, string $content): string
{
$headers = ["Content-Type: {$part->contentType()}"];
if ($charset = $part->charset()) {
$headers[0] .= "; charset=\"{$charset}\"";
}
if ($encoding = $part->encoding()) {
$headers[] = "Content-Transfer-Encoding: {$encoding}";
}
return implode("\r\n", $headers)."\r\n\r\n".$content;
}
}