id = "content";
$this->template = "import/list.tpl";
$this->layout = "common/layout";
require_once 'Zend/Mail/Protocol/Imap.php';
require_once 'Zend/Mail/Protocol/Pop3.php';
$request = Registry::get('request');
$db = Registry::get('db');
$lang = Registry::get('language');
if($this->request->post['type'] == 'pop3') {
try {
$conn = new Zend_Mail_Protocol_Pop3($this->request->post['server'], '110', false);
} catch (Zend_Mail_Protocol_Exception $e) {
print "" . $this->request->post['server'] . ": " . $lang->data['text_connection_failed'] . " ";
}
if($conn) {
$s = $conn->connect($this->request->post['server']);
if($s) {
try {
$conn->login($this->request->post['username'], $this->request->post['password']);
print "" . $lang->data['text_connection_ok'] . " ";
}
catch (Zend_Mail_Protocol_Exception $e) {
print "" . $this->request->post['username'] . ": " . $lang->data['text_login_failed'] . " ";
}
}
}
}
else if($this->request->post['type'] == 'imap' || $this->request->post['type'] == 'imap-ssl') {
$ssl = false;
if($this->request->post['type'] == 'imap-ssl') {
$ssl = 'SSL';
}
try {
$conn = new Zend_Mail_Protocol_Imap($this->request->post['server'], null, $ssl);
$login = $conn->login($this->request->post['username'], $this->request->post['password']);
if($login) {
print "" . $lang->data['text_connection_ok'] . " ";
} else {
print "" . $this->request->post['username'] . ": " . $lang->data['text_login_failed'] . " ";
}
} catch (Zend_Mail_Protocol_Exception $e) {
print "" . $this->request->post['server'] . ": " . $lang->data['text_connection_failed'] . " ";
}
}
else {
print "" . $lang->data['text_error'] . " ";
}
}
}