HeaderWords final class
Minn\Mail\HeaderWords · public/minn/src/Minn/Mail/HeaderWords.php · 112 lines
Header text as mail carries it (RFC 2047): left alone when it is plain and short enough, quoted when a phrase needs it, otherwise encoded words in Q (mostly ASCII) or B (mostly not), folded to the line length the transport allows: 63 for PHP's mail(), 998 otherwise. Plain text only becomes an encoded word to be folded when it is too long for one line.
Constants and properties
| const | MAIL_LINE = 63 | |
| const | SMTP_LINE = 998 | |
| private | ATEXT_PHRASE = '/[^A-Za-z0-9!#$%&\'*+\\/=?^_`{|}~ -]/' |
Public
| static | encode(string $text, string $position, string $charset, int $lineLength, string $eol): string# | The header text encoded for its position ("text", "phrase" or "comment").
| |||
| static | q(string $text, string $position = 'text'): string# | RFC 2047 "Q" encoding for a position: spaces as "_", and the characters the position cannot carry as =XX. | |||
| static | base64Lines(string $text, string $charset): array# | Base64 lines of at most 63 characters cut at whole characters, so a multibyte character is never split across encoded words. @return list<string> | |||
| static | decode(string $value, string $charset): string# | Encoded words decoded (adjacent ones joined) and converted into $charset; other text passes through. |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | specials(string $text, string $position): int# | How many characters the position counts as needing encoding. |
| private | bLines(string $text, string $charset, int $width): array# | @return list<string> |
| private | qLines(string $text, string $position, string $charset, int $width, string $eol): array# | @return list<string> |
Nothing matches.