to ) ) { return Result::permanent( 'invalid_recipient', __( 'نشانی ایمیل معتبر نیست.', 'rahkar-toolkit' ) ); } if ( '' === trim( $message->body ) ) { return Result::permanent( 'empty_body', __( 'متن ایمیل خالی است.', 'rahkar-toolkit' ) ); } $sent = wp_mail( $message->to, '' !== $message->subject ? $message->subject : get_bloginfo( 'name' ), $message->body, [ 'Content-Type: text/html; charset=UTF-8', ] ); if ( $sent ) { return Result::success(); } // `wp_mail` returning false usually means the transport refused the // handoff — a broken SMTP host, a rejected sender. Both can recover, so // this is worth another attempt rather than being parked immediately. return Result::retryable( 'send_failed', __( 'ارسال ایمیل توسط وردپرس ناموفق بود.', 'rahkar-toolkit' ) ); } /** * {@inheritDoc} * * Nothing to configure — the site's existing mail setup is the configuration. */ public function settingsSchema(): array { return []; } }