function emailCheck() { if (!empty($this->b['email'])) { $from = !empty($this->amp_conf['AMPBACKUPEMAILFROM']) ? $this->amp_conf['AMPBACKUPEMAILFROM'] : get_current_user() . '@' . gethostname(); if (function_exists('sysadmin_get_storage_email')) { $emails = sysadmin_get_storage_email(); if (!empty($emails['fromemail']) && filter_var($emails['fromemail'], FILTER_VALIDATE_EMAIL)) { $from = $emails['fromemail']; } } $subject = date("F j, Y, g:i a") . '-' . $this->b['name']; backup_email_log($this->b['email'], $from, $subject); } }
// $bootstrap_settings['freepbx_auth'] = false; if (!@(include_once getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { include_once '/etc/asterisk/freepbx.conf'; } // Define the notification class for logging to the dashboard // $nt = notifications::create($db); // Check to see if email should be sent // $cm =& cronmanager::create($db); $cm->run_jobs(); //If we have sysadmin installed $from_email = get_current_user() . '@' . gethostname(); if (function_exists('sysadmin_get_storage_email')) { $emails = sysadmin_get_storage_email(); //Check that what we got back above is a email address if (!empty($emails['fromemail']) && filter_var($emails['fromemail'], FILTER_VALIDATE_EMAIL)) { //Fallback address $from_email = $emails['fromemail']; } } //Send email with our mail class function chron_scheduler_send_message($to, $from, $subject, $message) { $em = new \CI_Email(); $em->from($from); $em->to($to); $em->subject($subject); $em->message($message); return $em->send();
/** * Send an email to a user * @param int $id The user ID * @param string $subject The email subject * @param string $body The email body */ public function sendEmail($id, $subject, $body) { $user = $this->getUserByID($id); if (empty($user) || empty($user['email'])) { return false; } $email_options = array('useragent' => $this->brand, 'protocol' => 'mail'); $email = new \CI_Email(); //TODO: Stop gap until sysadmin becomes a full class if (!function_exists('sysadmin_get_storage_email') && $this->FreePBX->Modules->checkStatus('sysadmin') && file_exists($this->FreePBX->Config()->get('AMPWEBROOT') . '/admin/modules/sysadmin/functions.inc.php')) { include $this->FreePBX->Config()->get('AMPWEBROOT') . '/admin/modules/sysadmin/functions.inc.php'; } $femail = $this->FreePBX->Config()->get('AMPUSERMANEMAILFROM'); if (function_exists('sysadmin_get_storage_email')) { $emails = sysadmin_get_storage_email(); if (!empty($emails['fromemail']) && filter_var($emails['fromemail'], FILTER_VALIDATE_EMAIL)) { $femail = $emails['fromemail']; } } $from = !empty($femail) ? $femail : get_current_user() . '@' . gethostname(); $email->from($from); $email->to($user['email']); $email->subject($subject); $email->message($body); $email->send(); }