@@ -104,11 +104,8 @@ public function send(Recipient $recipient, string $subject, string $text, array
104104 }
105105 $ email ->subject (htmlspecialchars_decode ($ subject ));
106106
107- $ html = $ this ->formatInternetMessage ($ text );
108- $ text = $ this ->formatInternetMessage (strip_tags ($ text ));
109-
110- $ email ->html ($ html );
111- $ email ->text ($ text );
107+ $ email ->html ($ text );
108+ $ email ->text (strip_tags ($ text ));
112109
113110 foreach ($ attachedResources as $ name => $ resource ) {
114111 if ($ resource instanceof PersistentResource) {
@@ -129,24 +126,6 @@ public function send(Recipient $recipient, string $subject, string $text, array
129126 $ mailer ->send ($ email );
130127 }
131128
132- /**
133- * Format according to https://datatracker.ietf.org/doc/html/rfc5322#section-2.1.1
134- */
135- private function formatInternetMessage (string $ text ): string
136- {
137- // Break the text into lines with a maximum of 78 characters
138- $ text = wordwrap ($ text , 78 , PHP_EOL , true );
139-
140- // Ensure no line or continuous sequence exceeds 998 characters
141- $ lines = explode (PHP_EOL , $ text );
142- foreach ($ lines as &$ line ) {
143- if (strlen ($ line ) > 998 ) {
144- $ line = chunk_split ($ line , 998 , PHP_EOL );
145- }
146- }
147- return implode (PHP_EOL , $ lines );
148- }
149-
150129 public function getPathFromPersistentResource (PersistentResource $ resource ): ?string
151130 {
152131 if (!is_string ($ resource ->getSha1 ())) {
0 commit comments