Пример #1
0
 public function index()
 {
     $this->template = "";
     $this->auto_render = FALSE;
     // First is IMAP PHP Library Installed?
     $modules = new Modulecheck();
     if ($modules->isLoaded('imap')) {
         // If SSL Enabled
         $ssl = Kohana::config('settings.email_ssl') == true ? "/ssl" : "";
         // Do not validate certificates (TLS/SSL server)
         //$novalidate = strtolower(Kohana::config('settings.email_servertype')) == "imap" ? "/novalidate-cert" : "";
         $novalidate = "/novalidate-cert";
         // If POP3 Disable TLS
         $notls = strtolower(Kohana::config('settings.email_servertype')) == "pop3" ? "/notls" : "";
         $service = "{" . Kohana::config('settings.email_host') . ":" . Kohana::config('settings.email_port') . "/" . Kohana::config('settings.email_servertype') . $notls . $ssl . $novalidate . "}";
         // Connected!
         if (@imap_open($service, Kohana::config('settings.email_username'), Kohana::config('settings.email_password'), 0, 1)) {
             echo json_encode(array("status" => "success", "message" => Kohana::lang('ui_main.success')));
         } else {
             echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_main.error') . " - " . imap_last_error()));
         }
     } else {
         echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_main.error') . " - " . Kohana::lang('ui_admin.error_imap')));
     }
 }
Пример #2
0
 public function index()
 {
     $modules = new Modulecheck();
     if ($modules->isLoaded('imap')) {
         $email_username = Kohana::config('settings.email_username');
         $email_password = Kohana::config('settings.email_password');
         $email_host = Kohana::config('settings.email_host');
         $email_port = Kohana::config('settings.email_port');
         $email_servertype = Kohana::config('settings.email_servertype');
         if (!empty($email_username) and !empty($email_password) and !empty($email_host) and !empty($email_port) and !empty($email_servertype)) {
             $check_email = new Imap();
             $messages = $check_email->get_messages();
             // Close Connection
             $check_email->close();
             // Add Messages
             $this->add_email($messages);
         } else {
             echo "Email is not configured.<BR /><BR />";
         }
     } else {
         echo "You Do Not Have the IMAP PHP Library installed. Email will not be retrieved.<BR/ ><BR/ >";
     }
 }