public function email($mailbox, $to, $subject, $template, $data = NULL, $type = \Painless\System\Common\Email::TEXT) { // Send a notification e-mail to the user $response = \Painless::execute(\Painless::RUN_INTERNAL, 'POST email/index.html', array('mailbox' => $mailbox, 'to' => $to, 'subject' => $subject, 'template' => $template, 'data' => $data)); // Only send the e-mail if the response code is 200 if ($response->status === 200) { $email = \Painless::load('system/common/email'); $email->contentType($type); $email->content($response->payload); return $email; } return NULL; }