forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
IMAP
World Wide Web Server edited this page Jul 4, 2012
·
19 revisions
[b]IMAP functionality in CodeIgniter[/b]
The point of this article is to develop some kind of IMAP functionality to CI, to connect to a mail server through IMAP, POP3 or NNTP.
Also to make a Class with the most used functions in building a webmail service.
/* Controller: Mail */
[code]
<?php
class Mail extends Controller {
// IMAP/POP3 (mail server) LOGIN
var $imap_server = 'mail.example.org';
var $imap_user = '[email protected]';
var $imap_pass = 'password';
// Constuctor
function __construct() {
parent::Controller();
$this->load->library('Imap');
}
// index
function index() {
$inbox = $this->imap->cimap_open($this->imap_server, 'INBOX', $this->imap_user, $this->imap_pass) or die(imap_last_error());
$data_array['totalmsg'] = $this->imap->cimap_num_msg($inbox);
$data_array['quota'] = $this->imap->cimap_get_quota($inbox);
$this->load->view('mail_view', $data_array);
}
}
?> [/code]