namespace WPForms\Tasks\Actions;
* Class EntryEmailsTask is responsible for defining how to send emails,
* when the form was submitted.
class EntryEmailsTask extends Task {
* Action name for this task.
const ACTION = 'wpforms_process_entry_emails';
public function __construct() {
parent::__construct( self::ACTION );
* Get the data from Tasks meta table, check/unpack it and
* send the email straight away.
* @since 1.5.9.3 Send immediately instead of calling \WPForms_Process::entry_email() method.
* @param int $meta_id ID for meta information for a task.
public static function process( $meta_id ) {
$meta = $task_meta->get( (int) $meta_id );
// We should actually receive something.
if ( empty( $meta ) || empty( $meta->data ) ) {
// We expect a certain number of params.
if ( count( $meta->data ) !== 5 ) {
// We expect a certain meta data structure for this task.
list( $to, $subject, $message, $headers, $attachments ) = $meta->data;
// Let's do this NOW, finally.
wp_mail( $to, $subject, $message, $headers, $attachments );