LLMS_Notification_Processor_Email::task( int $notification_id )
Processes an item in the queue
Description Description
Parameters Parameters
- $notification_id
-
(int) (Required) ID of an LLMS_Notification
Return Return
(boolean) false removes item from the queue true leaves it in the queue for further processing
Source Source
File: includes/notifications/processors/class.llms.notification.processor.email.php
protected function task( $notification_id ) { $this->log( sprintf( 'sending email notification ID #%d', $notification_id ) ); $notification = new LLMS_Notification( $notification_id ); $view = $notification->get_view(); if ( ! $view ) { $this->log( 'ID#' . $notification_id ); return false; } // setup the email $mailer = LLMS()->mailer()->get_email( 'notification' ); if ( ! $mailer->add_recipient( $notification->get( 'subscriber' ), 'to' ) ) { $this->log( sprintf( 'error sending email notification ID #%d - subscriber does not exist', $notification_id ) ); $notification->set( 'status', 'error' ); return false; } $mailer->set_subject( $view->get_subject() )->set_heading( $view->get_title() )->set_body( $view->get_html() ); // log when wp_mail fails if ( $mailer->send() ) { $notification->set( 'status', 'sent' ); } else { $this->log( sprintf( 'error sending email notification ID #%d', $notification_id ) ); } return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: