options()->get( 'enable_as_email_sending' ); } return $is_enabled; } /** * Send an email * * @param string $user_email User email. * @param string $template Template name. * @param array $args Email additional arguments. */ public function send( $user_email, $template, $args = array() ) { if ( empty( $user_email ) && empty( $template ) ) { return; } // @todo Workaround for now. Maybe we need to put base $user_id everytime if ( array_key_exists( 'fetch_user_id', $args ) ) { // When Action Scheduler is enabled, email sending script is located out of basic functionality, so we need to fetch the user for replace placeholders. if ( UM()->maybe_action_scheduler()->is_hook_enabled( 'um_dispatch_email' ) ) { um_fetch_user( $args['fetch_user_id'] ); } unset( $args['fetch_user_id'] ); } UM()->mail()->send( $user_email, $template, $args ); } } }