2010-04-14 13:20:40 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author markus
|
|
|
|
* $Id: IndexController.php 6 2009-11-18 14:52:50Z markus $
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once(LIBRARY_PATH . '/imap/imapConnection.php');
|
|
|
|
|
|
|
|
class MailController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
/* Initialize action controller here */
|
|
|
|
}
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2010-04-14 14:29:09 +00:00
|
|
|
$config = Zend_Registry::get('config');
|
|
|
|
$imap_config = $config->imap;
|
|
|
|
$imap = imapConnection::getInstance('cacert', $imap_config);
|
|
|
|
$imap->imapSwitchMbox('INBOX');
|
|
|
|
|
|
|
|
$ck = $imap->imapCheck();
|
|
|
|
|
|
|
|
$headers = array();
|
|
|
|
for ($i=0; $i < $ck->Nmsgs; $i++) {
|
|
|
|
$header = $imap->imapHeader($i+1);
|
|
|
|
$header->uid = $imap->imapUID($i+1);
|
|
|
|
$header->detailslink = $this->view->url(array('controller' => 'mail', 'action' => 'read', 'uid' => $header->uid), 'default', true);
|
|
|
|
$headers[] = $header;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->headers = $headers;
|
2010-04-14 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2010-04-14 14:29:09 +00:00
|
|
|
public function readAction()
|
|
|
|
{
|
|
|
|
$config = Zend_Registry::get('config');
|
|
|
|
$imap_config = $config->imap;
|
|
|
|
$imap = imapConnection::getInstance('cacert', $imap_config);
|
|
|
|
$imap->imapSwitchMbox('INBOX');
|
|
|
|
|
|
|
|
$uid = $this->getRequest()->getParam('uid');
|
2010-04-14 13:20:40 +00:00
|
|
|
|
2010-04-14 14:29:09 +00:00
|
|
|
$body = $imap->imapBodyByUID($uid);
|
2010-04-14 13:20:40 +00:00
|
|
|
|
2010-04-14 14:29:09 +00:00
|
|
|
$this->view->mail_body = $body;
|
|
|
|
}
|
|
|
|
}
|