PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Helpers/BounceHelper.php +11 -31 trunk → 11.1.0 View file →
@@ -347,22 +347,12 @@
347 347 }
348 348
349 349 public function decodeMessage(bool $attachments = false): bool
350 350 {
351 - try {
352 - if ($this->usePear) {
353 - return $this->decodeMessagePear($attachments);
354 - } else {
355 - return $this->decodeMessageImap($attachments);
356 - }
357 - } catch (\Throwable $e) {
358 - $subject = is_string($this->_message->subject ?? '') ? $this->_message->subject : '';
359 - $this->display(
360 - acym_translationSprintf('ACYM_ERROR_DECODING_MESSAGE_X_X', acym_stripTags($this->decodeHeader($subject)), $e->getMessage()),
361 - self::MESSAGE_TYPE_ERROR
362 - );
363 -
364 - return false;
351 + if ($this->usePear) {
352 + return $this->decodeMessagePear($attachments);
353 + } else {
354 + return $this->decodeMessageImap($attachments);
365 355 }
366 356 }
367 357
368 358 private function decodeMessagePear(bool $attachments): bool
@@ -520,13 +510,12 @@
520 510 }
521 511
522 512 private function decodeMessageImap(bool $attachments): bool
523 513 {
524 - try {
525 - $this->_message->structure = $this->callImapFunction('imap_fetchstructure', [$this->mailbox, $this->_message->messageNB]);
526 - } catch (\Throwable $e) {
527 - $this->_message->structure = null;
528 - $this->display(acym_translationSprintf('ACYM_BOUNCE_STRUCTURE_ERROR_X', $e->getMessage()), self::MESSAGE_TYPE_INFO);
514 + $this->_message->structure = $this->callImapFunction('imap_fetchstructure', [$this->mailbox, $this->_message->messageNB]);
515 +
516 + if (empty($this->_message->structure)) {
517 + return false;
529 518 }
530 519
531 520 $this->_message->headerinfo = $this->callImapFunction('imap_fetchheader', [$this->mailbox, $this->_message->messageNB]);
532 521
@@ -532,19 +521,10 @@
532 521
533 522 $this->_message->html = '';
534 523 $this->_message->text = '';
535 524
536 - // We could not read the structure of the message, we analyse its raw content instead
537 - if (empty($this->_message->structure)) {
538 - $body = $this->callImapFunction('imap_body', [$this->mailbox, $this->_message->messageNB]);
539 - if (empty($body)) {
540 - return false;
541 - }
542 -
543 - $this->_message->contentType = 0;
544 - $this->_message->text = substr($body, 0, 100000);
545 - } elseif ($this->_message->structure->type == 1) {
546 - // Multipart message : type == 1
525 + //Multipart message : type == 1
526 + if ($this->_message->structure->type == 1) {
547 527 $this->_message->contentType = 2;
548 528 if ($this->_message->structure->subtype === 'MIXED') {
549 529 $allParts = $this->explodeBodyMixed($this->_message->structure);
550 530 } else {
@@ -1579,9 +1559,9 @@
1579 1559 {
1580 1560 if ($this->config->get('bounce_server') === 'imap.gmail.com') {
1581 1561 $url = 'https://oauth2.googleapis.com/token';
1582 1562 } else {
1583 - $tenant = trim($this->config->get('bounce_tenant')) ?: 'consumers';
1563 + $tenant = $this->config->get('bounce_tenant', 'consumers');
1584 1564 $url = 'https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/token';
1585 1565 }
1586 1566
1587 1567 $oauth = new OAuth(