diff --git a/manager/application/controllers/MailController.php b/manager/application/controllers/MailController.php
index afe902b..5ee84d4 100644
--- a/manager/application/controllers/MailController.php
+++ b/manager/application/controllers/MailController.php
@@ -16,9 +16,35 @@ class MailController extends Zend_Controller_Action
public function indexAction()
{
- // action body
+ $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;
}
+ 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');
-}
+ $body = $imap->imapBodyByUID($uid);
+ $this->view->mail_body = $body;
+ }
+}
diff --git a/manager/application/views/scripts/mail/index.phtml b/manager/application/views/scripts/mail/index.phtml
index 4cbadc3..faf6bd4 100644
--- a/manager/application/views/scripts/mail/index.phtml
+++ b/manager/application/views/scripts/mail/index.phtml
@@ -3,5 +3,26 @@
* @author markus
* $Id: index.phtml 25 2009-12-02 15:43:21Z markus $
*/
+$this->headLink()->appendStylesheet('/css/mail.css');
?>
+
+
+ |
+ |
+ |
+ |
+ |
+
+headers as $header) {
+ print " \n";
+ print " detailslink . "\">" . $header->fromaddress . " | ";
+ print " " . $header->toaddress . " | ";
+ print " " . $header->subject . " | ";
+ print " " . $header->date . " | ";
+ print " " . $header->Size . " | ";
+ print "
\n";
+}
+?>
+
diff --git a/manager/application/views/scripts/mail/read.phtml b/manager/application/views/scripts/mail/read.phtml
new file mode 100644
index 0000000..1d64d5e
--- /dev/null
+++ b/manager/application/views/scripts/mail/read.phtml
@@ -0,0 +1,10 @@
+headLink()->appendStylesheet('/css/mail.css');
+?>
+
+mail_body);
\ No newline at end of file
diff --git a/manager/library/imap/imapConnection.php b/manager/library/imap/imapConnection.php
index f78dc3d..1528a76 100644
--- a/manager/library/imap/imapConnection.php
+++ b/manager/library/imap/imapConnection.php
@@ -407,8 +407,8 @@ class imapConnection {
if ($ret === false) {
if ($reconnect === true) {
$this->imap = $this->imapOpen($this->server.$this->mbox,
- $this->config->getValue('username'),
- $this->config->getValue('password'),
+ $this->config->username,
+ $this->config->password,
OP_HALFOPEN);
$ret = imap_ping($this->imap);
@@ -471,26 +471,26 @@ class imapConnection {
* @param $instanceName
* @param $config
*/
- protected function __construct($instanceName,$config) {
+ protected function __construct($instanceName, $config) {
$this->instanceName = $instanceName;
$this->config = $config;
- if (!$this->config->hasValue('mailhost')) {
+ if (!isset($this->config->mailhost)) {
throw new IMAPException(__METHOD__ . ' config attribute missing: "mailhost"');
}
- if (!$this->config->hasValue('username')) {
+ if (!isset($this->config->username)) {
throw new IMAPException(__METHOD__ . ' config attribute missing: "username"');
}
- if (!$this->config->hasValue('password')) {
+ if (!isset($this->config->password)) {
throw new IMAPException(__METHOD__ . ' config attribute missing: "password"');
}
- if (!$this->config->hasValue('port')) {
+ if (!isset($this->config->port)) {
throw new IMAPException(__METHOD__ . ' config attribute missing: "port"');
}
- $this->server = '{'.$this->config->getValue('mailhost').':'.$this->config->getValue('port').'/imap';
- if( $this->config->hasValue('use_tls') &&
- $this->config->getValue('use_tls') == true ) {
+ $this->server = '{'.$this->config->mailhost.':'.$this->config->port.'/imap';
+ if( isset($this->config->use_tls) &&
+ $this->config->use_tls != 0 ) {
$this->server .= '/tls';
}
$this->server .= '/novalidate-cert}';
@@ -502,8 +502,8 @@ class imapConnection {
$this->imap = null;
$this->imap = $this->imapOpen($this->server.$mbox,
- $this->config->getValue('username'),
- $this->config->getValue('password'),
+ $this->config->username,
+ $this->config->password,
OP_HALFOPEN);
if ($this->imap === false) {
@@ -535,9 +535,11 @@ class imapConnection {
return $instance;
}
+ /*
if (!$config instanceof Config) {
throw new IMAPException(__METHOD__ . ' no config');
}
+ */
$object = new imapConnection($instanceName, $config);
diff --git a/manager/public/css/mail.css b/manager/public/css/mail.css
new file mode 100644
index 0000000..6cd0274
--- /dev/null
+++ b/manager/public/css/mail.css
@@ -0,0 +1,25 @@
+@CHARSET "UTF-8";
+
+#content table {
+ border: 1px solid black;
+ border-collapse: collapse;
+}
+
+#content th {
+ border: 1px solid black;
+ padding: 3px;
+}
+
+#content td {
+ border: 1px solid black;
+ padding: 3px;
+}
+
+#content a {
+ text-decoration: none;
+ color: #000000;
+}
+
+#content a:hover {
+ color: #777777;
+}