$attachmentUrl) { $fileName = is_string($fileName) ? $fileName : basename($attachmentUrl); $attachments[] = (object)[ 'filename' => $attachmentUrl, 'name' => $fileName, 'url' => str_replace(ACYM_ROOT, ACYM_LIVE, $attachmentUrl), ]; } } $mailerHelper = new MailerHelper(); $mailerHelper->report = false; $success = $mailerHelper->overrideEmail( [ 'subject' => $args['subject'], 'message' => $args['message'], 'to' => $to, 'isHtml' => $contentType !== 'text/plain', 'headers' => $headers, 'bcc' => $bcc, 'attachments' => $attachments, ] ); if ($success) { add_action('phpmailer_init', [$this, 'blockEmailSending']); add_filter('post_smtp_do_send_email', [$this, 'blockEmailSendingPostSMTP']); } return $args; } public function blockEmailSending(&$phpmailer) { $phpmailer = new FakePhpMailer(); } public function blockEmailSendingPostSMTP($shouldSend) { return false; } }