@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | if ($result['rule_no'] == '0000') { |
524 | 524 | if ($debug_mode) { |
525 | - echo 'Body:' . $bmh_newline . $body . $bmh_newline; |
|
525 | + echo 'Body:'.$bmh_newline.$body.$bmh_newline; |
|
526 | 526 | echo $bmh_newline; |
527 | 527 | } |
528 | 528 | } else { |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
573 | 573 | $email_arr = @imap_rfc822_parse_adrlist($email, 'default.domain.name'); |
574 | 574 | if (isset($email_arr[0]->host) && $email_arr[0]->host != '.SYNTAX-ERROR.' && $email_arr[0]->host != 'default.domain.name') { |
575 | - $result['email'] = $email_arr[0]->mailbox . '@' . $email_arr[0]->host; |
|
575 | + $result['email'] = $email_arr[0]->mailbox.'@'.$email_arr[0]->host; |
|
576 | 576 | } |
577 | 577 | } elseif (preg_match('/Final-Recipient: rfc822;(.*)/i', $dsn_report, $match)) { |
578 | 578 | $email = trim($match[1], "<> \t\r\n\0\x0B"); |
579 | 579 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
580 | 580 | $email_arr = @imap_rfc822_parse_adrlist($email, 'default.domain.name'); |
581 | 581 | if (isset($email_arr[0]->host) && $email_arr[0]->host != '.SYNTAX-ERROR.' && $email_arr[0]->host != 'default.domain.name') { |
582 | - $result['email'] = $email_arr[0]->mailbox . '@' . $email_arr[0]->host; |
|
582 | + $result['email'] = $email_arr[0]->mailbox.'@'.$email_arr[0]->host; |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | * Delivery to the following recipients failed. |
1550 | 1550 | * [email protected] |
1551 | 1551 | */ |
1552 | - elseif (preg_match("/Delivery to the following recipients failed.*\n.*\n.*" . $result['email'] . '/i', $dsn_msg)) { |
|
1552 | + elseif (preg_match("/Delivery to the following recipients failed.*\n.*\n.*".$result['email'].'/i', $dsn_msg)) { |
|
1553 | 1553 | $result['rule_cat'] = 'other'; |
1554 | 1554 | $result['rule_no'] = '0176'; |
1555 | 1555 | } |
@@ -1596,11 +1596,11 @@ discard block |
||
1596 | 1596 | |
1597 | 1597 | if ($result['rule_no'] == '0000') { |
1598 | 1598 | if ($debug_mode) { |
1599 | - echo 'email: ' . $result['email'] . $bmh_newline; |
|
1600 | - echo 'Action: ' . $action . $bmh_newline; |
|
1601 | - echo 'Status: ' . $status_code . $bmh_newline; |
|
1602 | - echo 'Diagnostic-Code: ' . $diag_code . $bmh_newline; |
|
1603 | - echo "DSN Message:<br />\n" . $dsn_msg . $bmh_newline; |
|
1599 | + echo 'email: '.$result['email'].$bmh_newline; |
|
1600 | + echo 'Action: '.$action.$bmh_newline; |
|
1601 | + echo 'Status: '.$status_code.$bmh_newline; |
|
1602 | + echo 'Diagnostic-Code: '.$diag_code.$bmh_newline; |
|
1603 | + echo "DSN Message:<br />\n".$dsn_msg.$bmh_newline; |
|
1604 | 1604 | echo $bmh_newline; |
1605 | 1605 | } |
1606 | 1606 | } else { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | namespace BounceMailHandler; |
22 | 22 | |
23 | -require_once __DIR__ . '/phpmailer-bmh_rules.php'; |
|
23 | +require_once __DIR__.'/phpmailer-bmh_rules.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * BounceMailHandler class |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | { |
320 | 320 | // before starting the processing, let's check the delete flag and do global deletes if true |
321 | 321 | if (\trim($this->deleteMsgDate) != '') { |
322 | - echo 'processing global delete based on date of ' . $this->deleteMsgDate . '<br />'; |
|
322 | + echo 'processing global delete based on date of '.$this->deleteMsgDate.'<br />'; |
|
323 | 323 | $this->globalDelete(); |
324 | 324 | } |
325 | 325 | |
@@ -329,24 +329,24 @@ discard block |
||
329 | 329 | $this->moveHard = false; |
330 | 330 | } |
331 | 331 | |
332 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; |
|
332 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; |
|
333 | 333 | |
334 | 334 | \set_time_limit(self::SECONDS_TIMEOUT); |
335 | 335 | |
336 | 336 | if (!$this->testMode) { |
337 | - $this->mailboxLink = \imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0)); |
|
337 | + $this->mailboxLink = \imap_open('{'.$this->mailhost.':'.$port.'}'.$this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0)); |
|
338 | 338 | } else { |
339 | - $this->mailboxLink = \imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0)); |
|
339 | + $this->mailboxLink = \imap_open('{'.$this->mailhost.':'.$port.'}'.$this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0)); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | if (!$this->mailboxLink) { |
343 | - $this->errorMessage = 'Cannot create ' . $this->service . ' connection to ' . $this->mailhost . $this->bmhNewLine . 'Error MSG: ' . imap_last_error(); |
|
343 | + $this->errorMessage = 'Cannot create '.$this->service.' connection to '.$this->mailhost.$this->bmhNewLine.'Error MSG: '.imap_last_error(); |
|
344 | 344 | $this->output(); |
345 | 345 | |
346 | 346 | return false; |
347 | 347 | } |
348 | 348 | |
349 | - $this->output('Connected to: ' . $this->mailhost . ' (' . $this->mailboxUserName . ')'); |
|
349 | + $this->output('Connected to: '.$this->mailhost.' ('.$this->mailboxUserName.')'); |
|
350 | 350 | |
351 | 351 | return true; |
352 | 352 | } |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | $dateArr = \explode('-', $this->deleteMsgDate); // date format is yyyy-mm-dd |
362 | 362 | $delDate = \mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]); |
363 | 363 | |
364 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; |
|
365 | - $mboxt = \imap_open('{' . $this->mailhost . ':' . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); |
|
364 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; |
|
365 | + $mboxt = \imap_open('{'.$this->mailhost.':'.$port.'}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); |
|
366 | 366 | |
367 | 367 | if ($mboxt === false) { |
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | |
371 | - $list = \imap_getmailboxes($mboxt, '{' . $this->mailhost . ':' . $port . '}', '*'); |
|
371 | + $list = \imap_getmailboxes($mboxt, '{'.$this->mailhost.':'.$port.'}', '*'); |
|
372 | 372 | |
373 | 373 | if (\is_array($list)) { |
374 | 374 | foreach ($list as $key => $val) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $nameRaw = $nameArr[\count($nameArr) - 1]; |
378 | 378 | |
379 | 379 | if (false === \stripos($nameRaw, 'sent')) { |
380 | - $mboxd = \imap_open('{' . $this->mailhost . ':' . $port . '}' . $nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE); |
|
380 | + $mboxd = \imap_open('{'.$this->mailhost.':'.$port.'}'.$nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE); |
|
381 | 381 | $messages = \imap_sort($mboxd, SORTDATE, 0); |
382 | 382 | $i = 0; |
383 | 383 | |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | { |
418 | 418 | if ($this->verbose >= $verboseLevel) { |
419 | 419 | if ($msg) { |
420 | - echo $msg . $this->bmhNewLine; |
|
420 | + echo $msg.$this->bmhNewLine; |
|
421 | 421 | } else { |
422 | - echo $this->errorMessage . $this->bmhNewLine; |
|
422 | + echo $this->errorMessage.$this->bmhNewLine; |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | if (!$this->mailboxLink) { |
445 | - $this->errorMessage = 'Cannot open the mailbox file to ' . $filePath . $this->bmhNewLine . 'Error MSG: ' . imap_last_error(); |
|
445 | + $this->errorMessage = 'Cannot open the mailbox file to '.$filePath.$this->bmhNewLine.'Error MSG: '.imap_last_error(); |
|
446 | 446 | $this->output(); |
447 | 447 | |
448 | 448 | return false; |
449 | 449 | } |
450 | 450 | |
451 | - $this->output('Opened ' . $filePath); |
|
451 | + $this->output('Opened '.$filePath); |
|
452 | 452 | |
453 | 453 | return true; |
454 | 454 | } |
@@ -489,12 +489,12 @@ discard block |
||
489 | 489 | $unprocessedCount = 0; |
490 | 490 | $deletedCount = 0; |
491 | 491 | $movedCount = 0; |
492 | - $this->output('Total: ' . $totalCount . ' messages '); |
|
492 | + $this->output('Total: '.$totalCount.' messages '); |
|
493 | 493 | |
494 | 494 | // process maximum number of messages |
495 | 495 | if ($fetchedCount > $this->maxMessages) { |
496 | 496 | $fetchedCount = $this->maxMessages; |
497 | - $this->output('Processing first ' . $fetchedCount . ' messages '); |
|
497 | + $this->output('Processing first '.$fetchedCount.' messages '); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | if ($this->testMode) { |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $processedResult = $this->processBounce($x, 'DSN', $totalCount); |
537 | 537 | } else { |
538 | 538 | // not standard DSN msg |
539 | - $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT); |
|
539 | + $this->output('Msg #'.$x.' is not a standard DSN message', self::VERBOSE_REPORT); |
|
540 | 540 | |
541 | 541 | if ($this->debugBodyRule) { |
542 | 542 | if ($structure->ifdescription) { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | $processedResult = $this->processBounce($x, 'DSN', $totalCount); |
563 | 563 | } else { |
564 | 564 | // not standard DSN msg |
565 | - $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT); |
|
565 | + $this->output('Msg #'.$x.' is not a standard DSN message', self::VERBOSE_REPORT); |
|
566 | 566 | |
567 | 567 | if ($this->debugBodyRule) { |
568 | 568 | $this->output(" Content-Type : {$match[1]}", self::VERBOSE_DEBUG); |
@@ -572,10 +572,10 @@ discard block |
||
572 | 572 | } |
573 | 573 | } else { |
574 | 574 | // didn't get content-type header |
575 | - $this->output('Msg #' . $x . ' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT); |
|
575 | + $this->output('Msg #'.$x.' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT); |
|
576 | 576 | |
577 | 577 | if ($this->debugBodyRule) { |
578 | - $this->output(' Headers: ' . $this->bmhNewLine . $header . $this->bmhNewLine, self::VERBOSE_DEBUG); |
|
578 | + $this->output(' Headers: '.$this->bmhNewLine.$header.$this->bmhNewLine, self::VERBOSE_DEBUG); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | $processedResult = $this->processBounce($x, 'BODY', $totalCount); |
@@ -651,17 +651,17 @@ discard block |
||
651 | 651 | \flush(); |
652 | 652 | } |
653 | 653 | |
654 | - $this->output($this->bmhNewLine . 'Closing mailbox, and purging messages'); |
|
654 | + $this->output($this->bmhNewLine.'Closing mailbox, and purging messages'); |
|
655 | 655 | |
656 | 656 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
657 | 657 | @\imap_expunge($this->mailboxLink); |
658 | 658 | \imap_close($this->mailboxLink); |
659 | 659 | |
660 | - $this->output('Read: ' . $fetchedCount . ' messages'); |
|
661 | - $this->output($processedCount . ' action taken'); |
|
662 | - $this->output($unprocessedCount . ' no action taken'); |
|
663 | - $this->output($deletedCount . ' messages deleted'); |
|
664 | - $this->output($movedCount . ' messages moved'); |
|
660 | + $this->output('Read: '.$fetchedCount.' messages'); |
|
661 | + $this->output($processedCount.' action taken'); |
|
662 | + $this->output($unprocessedCount.' no action taken'); |
|
663 | + $this->output($deletedCount.' messages deleted'); |
|
664 | + $this->output($movedCount.' messages moved'); |
|
665 | 665 | |
666 | 666 | return true; |
667 | 667 | } |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | break; |
770 | 770 | |
771 | 771 | default: // un-support Content-type |
772 | - $this->output('Msg #' . $pos . ' is unsupported Content-Type:' . $structure->type, self::VERBOSE_REPORT); |
|
772 | + $this->output('Msg #'.$pos.' is unsupported Content-Type:'.$structure->type, self::VERBOSE_REPORT); |
|
773 | 773 | |
774 | 774 | return false; |
775 | 775 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | } |
817 | 817 | |
818 | 818 | if ($this->testMode) { |
819 | - $this->output('Match: ' . $ruleNumber . ':' . $ruleCategory . '; ' . $bounceType . '; ' . $email); |
|
819 | + $this->output('Match: '.$ruleNumber.':'.$ruleCategory.'; '.$bounceType.'; '.$email); |
|
820 | 820 | } else { |
821 | 821 | // code below will use the Callback function, but return no value |
822 | 822 | $params = [ |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | } else { |
842 | 842 | // match rule, do bounce action |
843 | 843 | if ($this->testMode) { |
844 | - $this->output('Match: ' . $ruleNumber . ':' . $ruleCategory . '; ' . $bounceType . '; ' . $email); |
|
844 | + $this->output('Match: '.$ruleNumber.':'.$ruleCategory.'; '.$bounceType.'; '.$email); |
|
845 | 845 | |
846 | 846 | return true; |
847 | 847 | } |
@@ -884,19 +884,19 @@ discard block |
||
884 | 884 | if (\trim($mailbox) == '') { |
885 | 885 | // this is a critical error with either the mailbox name blank or an invalid mailbox name |
886 | 886 | // need to stop processing and exit at this point |
887 | - echo 'Invalid mailbox name for move operation. Cannot continue: ' . $mailbox . "<br />\n"; |
|
887 | + echo 'Invalid mailbox name for move operation. Cannot continue: '.$mailbox."<br />\n"; |
|
888 | 888 | exit(); |
889 | 889 | } |
890 | 890 | |
891 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; |
|
891 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; |
|
892 | 892 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
893 | - $mbox = @\imap_open('{' . $this->mailhost . ':' . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); |
|
893 | + $mbox = @\imap_open('{'.$this->mailhost.':'.$port.'}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); |
|
894 | 894 | |
895 | 895 | if ($mbox === false) { |
896 | 896 | return false; |
897 | 897 | } |
898 | 898 | |
899 | - $list = \imap_getmailboxes($mbox, '{' . $this->mailhost . ':' . $port . '}', '*'); |
|
899 | + $list = \imap_getmailboxes($mbox, '{'.$this->mailhost.':'.$port.'}', '*'); |
|
900 | 900 | $mailboxFound = false; |
901 | 901 | |
902 | 902 | if (\is_array($list)) { |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | |
912 | 912 | if ($mailboxFound === false && $create) { |
913 | 913 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
914 | - @\imap_createmailbox($mbox, \imap_utf7_encode('{' . $this->mailhost . ':' . $port . '}' . $mailbox)); |
|
914 | + @\imap_createmailbox($mbox, \imap_utf7_encode('{'.$this->mailhost.':'.$port.'}'.$mailbox)); |
|
915 | 915 | \imap_close($mbox); |
916 | 916 | |
917 | 917 | return true; |