@@ -125,6 +125,14 @@ public function setMailer(Mailer $mailer) : static
125
125
return $ this ;
126
126
}
127
127
128
+ protected function getCrlf () : string
129
+ {
130
+ if (isset ($ this ->mailer )) {
131
+ return $ this ->mailer ->getCrlf ();
132
+ }
133
+ return "\r\n" ;
134
+ }
135
+
128
136
public function setBoundary (string $ boundary = null ) : static
129
137
{
130
138
$ this ->boundary = $ boundary ?? \bin2hex (\random_bytes (16 ));
@@ -178,7 +186,7 @@ public function getHeaderLines() : array
178
186
179
187
protected function renderHeaders () : string
180
188
{
181
- return \implode ($ this ->mailer -> getCrlf (), $ this ->getHeaderLines ());
189
+ return \implode ($ this ->getCrlf (), $ this ->getHeaderLines ());
182
190
}
183
191
184
192
protected function prepareHeaders () : void
@@ -196,7 +204,7 @@ protected function prepareHeaders() : void
196
204
protected function renderData () : string
197
205
{
198
206
$ boundary = $ this ->getBoundary ();
199
- $ crlf = $ this ->mailer -> getCrlf ();
207
+ $ crlf = $ this ->getCrlf ();
200
208
$ this ->prepareHeaders ();
201
209
$ data = $ this ->renderHeaders () . $ crlf . $ crlf ;
202
210
$ data .= '--mixed- ' . $ boundary . $ crlf ;
@@ -260,7 +268,7 @@ protected function renderMessage(
260
268
string $ contentType = 'text/html '
261
269
) : string {
262
270
$ message = \base64_encode ($ message );
263
- $ crlf = $ this ->mailer -> getCrlf ();
271
+ $ crlf = $ this ->getCrlf ();
264
272
$ part = '--alt- ' . $ this ->getBoundary () . $ crlf ;
265
273
$ part .= 'Content-Type: ' . $ contentType . '; charset= '
266
274
. $ this ->mailer ->getCharset () . $ crlf ;
@@ -311,7 +319,7 @@ public function getInlineAttachments() : array
311
319
protected function renderAttachments () : string
312
320
{
313
321
$ part = '' ;
314
- $ crlf = $ this ->mailer -> getCrlf ();
322
+ $ crlf = $ this ->getCrlf ();
315
323
foreach ($ this ->getAttachments () as $ attachment ) {
316
324
if ( ! \is_file ($ attachment )) {
317
325
throw new LogicException ('Attachment file not found: ' . $ attachment );
@@ -332,7 +340,7 @@ protected function renderAttachments() : string
332
340
protected function renderInlineAttachments () : string
333
341
{
334
342
$ part = '' ;
335
- $ crlf = $ this ->mailer -> getCrlf ();
343
+ $ crlf = $ this ->getCrlf ();
336
344
foreach ($ this ->getInlineAttachments () as $ cid => $ filename ) {
337
345
if ( ! \is_file ($ filename )) {
338
346
throw new LogicException ('Inline attachment file not found: ' . $ filename );
0 commit comments