/**
  * Method triggered to send email
  *
  * @param int $args
  *
  * @return void
  * @since  1.0
  * @author Emanuela Castorina <*****@*****.**>
  */
 public function trigger($args)
 {
     $this->raq = $args;
     $this->raq['raq_content'] = YITH_Request_Quote()->get_raq_return();
     $return = $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
     if ($return) {
         YITH_Request_Quote()->clear_raq_list();
         yith_ywraq_add_notice(__('Your request has been sent successfully', 'ywraq'), 'success');
     } else {
         yith_ywraq_add_notice(__('There was a problem in sending your request. Please try again.', 'ywraq'), 'error');
     }
 }
 /**
  * Get all errors in HTML mode or simple string.
  *
  * @return void
  * @since 1.0.0
  */
 public function send_message()
 {
     if (!isset($_POST['rqa_name'])) {
         return;
     }
     $errors = array();
     if (isset($_POST['raq_mail_wpnonce']) && wp_verify_nonce($_POST['raq_mail_wpnonce'], 'send-request-quote')) {
         $regex = '/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/';
         if (empty($_POST['rqa_name'])) {
             $errors[] = '<p>' . __('Please enter a name', 'yith-woocommerce-request-a-quote') . '</p>';
         }
         if (!isset($_POST['rqa_email']) || empty($_POST['rqa_email']) || !preg_match($regex, $_POST['rqa_email'])) {
             $errors[] = '<p>' . __('Please enter a valid email', 'yith-woocommerce-request-a-quote') . '</p>';
         }
         if (YITH_Request_Quote()->is_empty()) {
             $errors[] = '<p>' . __('Your list is empty, add products to the list to send a request', 'yith-woocommerce-request-a-quote') . '</p>';
         }
         if (empty($errors)) {
             $args = array('user_name' => $_POST['rqa_name'], 'user_email' => $_POST['rqa_email'], 'user_message' => nl2br($_POST['rqa_message']), 'raq_content' => YITH_Request_Quote()->get_raq_return());
             do_action('ywraq_process', $args);
             do_action('send_raq_mail', $args);
             wp_redirect(YITH_Request_Quote()->get_raq_page_url(), 301);
             exit;
         }
     } else {
         $errors[] = '<p>' . __('There was a problem in sending your request. Please try again.', 'yith-woocommerce-request-a-quote') . '</p>';
     }
     yith_ywraq_add_notice($this->get_errors($errors), 'error');
 }