Server IP : 104.21.14.103 / Your IP : 18.227.102.195 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Mailer/Methods/ErrorMappers/ |
Upload File : |
<?php declare(strict_types = 1); namespace MailPoet\Mailer\Methods\ErrorMappers; if (!defined('ABSPATH')) exit; use MailPoet\Mailer\Mailer; use MailPoet\Mailer\MailerError; use MailPoet\Mailer\SubscriberError; class AmazonSESMapper { use BlacklistErrorMapperTrait; use ConnectionErrorMapperTrait; const METHOD = Mailer::METHOD_AMAZONSES; public function getErrorFromException(\Exception $e, $subscriber) { $level = MailerError::LEVEL_HARD; if (strpos($e->getMessage(), 'Invalid address') !== false && strpos($e->getMessage(), '(to):') !== false) { $level = MailerError::LEVEL_SOFT; } $subscriberErrors = [new SubscriberError($subscriber, null)]; return new MailerError(MailerError::OPERATION_SEND, $level, $e->getMessage(), null, $subscriberErrors); } /** * @see https://docs.aws.amazon.com/ses/latest/DeveloperGuide/api-error-codes.html * @return MailerError */ public function getErrorFromResponse($response, $subscriber) { $message = ($response) ? $response->Error->Message->__toString() : // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps // translators: %s is the name of the method. sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES); $level = MailerError::LEVEL_HARD; if ($response && $response->Error->Code->__toString() === 'MessageRejected') { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps $level = MailerError::LEVEL_SOFT; } $subscriberErrors = [new SubscriberError($subscriber, null)]; return new MailerError(MailerError::OPERATION_SEND, $level, $message, null, $subscriberErrors); } }