diff options
Diffstat (limited to 'Postman/PostmanWpMail.php')
-rw-r--r-- | Postman/PostmanWpMail.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Postman/PostmanWpMail.php b/Postman/PostmanWpMail.php index f5fcf7f..173b35e 100644 --- a/Postman/PostmanWpMail.php +++ b/Postman/PostmanWpMail.php @@ -235,6 +235,13 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { PostmanEmailLogService::getInstance()->writeFailureLog( $log, $message, $engine->getTranscript(), $transport, $e->getMessage() ); } + // Fallback + if ( $this->fallback( $log, $message, $options ) ) { + + return true; + + } + $mail_error_data = array( 'to' => $message->getToRecipients(), 'subject' => $message->getSubject(), @@ -248,9 +255,29 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { // return failure return false; + } } + private function fallback( $log, $postMessage,$options ) { + + if ( ! $options->is_fallback && $options->getFallbackIsEnabled() && $options->getFallbackIsEnabled() == 'yes' ) { + + $options->is_fallback = true; + + $status = $this->sendMessage( $postMessage, $log ); + + $options->is_fallback = false; + + return $status; + + } else { + $options->is_fallback = false; + } + + return false; + } + /** * Clean up after sending the mail * |