Title: Emails not triggered when using Forminator_API::add_form_entry
Last modified: April 15, 2025

---

# Emails not triggered when using Forminator_API::add_form_entry

 *  Resolved [flojdm](https://wordpress.org/support/users/flojdm/)
 * (@flojdm)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/emails-not-triggered-when-using-forminator_apiadd_form_entry/)
 * Hi,
 * I’m using `Forminator_API::add_form_entry` to submit form data via a custom REST
   API endpoint. The data is correctly saved in the backend — I can see the submission
   under _Forminator > Submissions_, and all fields are correctly mapped.
 * However, the email notifications (both admin and user confirmation messages) 
   are **not sent** automatically when using this method.
 * To be clear:
    - The form is configured to send an automatic confirmation email to the user(
      e.g. “Thanks for your request, we’ll get back to you shortly.”).
    - An admin notification is also configured.
    - These emails are **not sent when submitting via the API** using `add_form_entry`.
    - If I go to _Forminator > Submissions > [Entry] > Resend Email_, both the user
      and admin emails are sent successfully, proving that everything is mapped 
      correctly and the configuration is working.
 * This confirms that:
    - The issue is not with the form setup or email configuration.
    - The problem is that `Forminator_API::add_form_entry` only saves the data but
      does **not** trigger the form’s built-in email notification workflow.
 * Is there a proper way to trigger the full submission process (including notifications)
   programmatically, or is there a recommended hook or method to manually trigger
   the email sending after using `add_form_entry`?
 * Thanks in advance for your help!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Kris – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport13/)
 * (@wpmudevsupport13)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/emails-not-triggered-when-using-forminator_apiadd_form_entry/#post-18418056)
 * Hi [@flojdm](https://wordpress.org/support/users/flojdm/)
 * I hope you are doing well today.
 * I pinged our Forminator Team to review your query and see what will be possible
   in this case. We will post an update here as soon as more information is available.
 * Kind Regards,
   Kris
 *  Thread Starter [flojdm](https://wordpress.org/support/users/flojdm/)
 * (@flojdm)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/emails-not-triggered-when-using-forminator_apiadd_form_entry/#post-18418979)
 * **Hey, thanks for the quick response!**
 * While waiting to hear back from the dev team, I explored the plugin source code
   to understand how Forminator handles mail sending internally, and I managed to
   get everything working.
 * After creating the entry with `Forminator_API::add_form_entry`, I manually retrieved
   the latest entry and invoked the internal mail handler like this:
 *     ```wp-block-code
           $result = Forminator_API::add_form_entry( $form->id, $meta );    $entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id($form->id);    $entry_id = $entry->entry_id;    $forminator_mail_sender = new Forminator_CForm_Front_Mail();    $entry = new Forminator_Form_Entry_Model( $entry_id );    if ( empty( $entry->form_id ) || ! empty( $entry->draft_id ) ) {        wp_send_json_error( esc_html__( 'Entry ID was not found.', 'forminator' ) );    }    $module_id = $entry->form_id;    Forminator_Front_Action::$module_id     = $module_id;    Forminator_Front_Action::$module_object = Forminator_Base_Form_Model::get_model( $module_id );    Forminator_Front_Action::$prepared_data = recreate_prepared_data( Forminator_Front_Action::$module_object, $entry );    if ( ! Forminator_Front_Action::$module_object ) {        wp_send_json_error( esc_html__( 'Error: Module object is corrupted!', 'forminator' ) );    }    Forminator_Front_Action::$module_settings = method_exists( Forminator_Front_Action::$module_object, 'get_form_settings' )            ? Forminator_Front_Action::$module_object->get_form_settings() : Forminator_Front_Action::$module_object->settings;    Forminator_CForm_Front_Action::check_fields_visibility();    $module_object = Forminator_Base_Form_Model::get_model( $module_id );    $forminator_mail_sender->process_mail( $module_object, $entry );     return ['error' => false];  
       ```
   
 * This allowed me to simulate the full frontend submission flow and trigger email
   notifications as expected (both to the admin and the user). Everything works 
   perfectly now.
 * Hope this helps someone else in the meantime!
   Let me know if you’d like a cleaner
   utility function for this in a future release.Best regards,
 *  [Kris – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport13/)
 * (@wpmudevsupport13)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/emails-not-triggered-when-using-forminator_apiadd_form_entry/#post-18419037)
 * Hi again [@flojdm](https://wordpress.org/support/users/flojdm/)
 * To give an idea we can suggest that you need to create an object for this class`
   Forminator_CForm_Front_Mail`and call the function `process_mail` with the required
   arguments for sending the mail.
 * Example:
 *     ```wp-block-code
       $forminator_mail_sender = new Forminator_CForm_Front_Mail();$forminator_mail_sender->process_mail( Forminator_Front_Action::$module_object, $entry, $submitted_data );
       ```
   
 * Kind Regards,
   Kris
 *  Plugin Support [Nithin – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport11/)
 * (@wpmudevsupport11)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/emails-not-triggered-when-using-forminator_apiadd_form_entry/#post-18433072)
 * Hi [@flojdm](https://wordpress.org/support/users/flojdm/),
 * Since we haven’t heard from you for a while. I’ll mark this thread as resolved
   for now. Please feel free to re-open this thread if you need any further assistance.
 * Best Regards,
 * Nithin

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Emails not triggered when using Forminator_API::add_form_entry’ is closed
to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [emails](https://wordpress.org/support/topic-tag/emails/)

 * 4 replies
 * 3 participants
 * Last reply from: [Nithin – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport11/)
 * Last activity: [1 year, 1 month ago](https://wordpress.org/support/topic/emails-not-triggered-when-using-forminator_apiadd_form_entry/#post-18433072)
 * Status: resolved