added imap support to the gui

This commit is contained in:
SJ 2013-09-09 15:02:30 +02:00
parent 5bbf9458af
commit 5161103a44
4 changed files with 43 additions and 4 deletions

View File

@ -441,10 +441,12 @@ ENDE:
rc = import_from_imap_server(s_server, s_username, s_password, 143, sdata, data, skiplist, dryrun, cfg);
}
if(rc == ERR){
// don't set error in case of a problem, because it
// will scare users looking at the gui progressbar
/*if(rc == ERR){
data->import->status = 3;
update_import_job_stat(sdata, data);
}
}*/
return rc;
}

View File

@ -17,6 +17,7 @@ class ControllerImportTest extends Controller {
$db = Registry::get('db');
$lang = Registry::get('language');
if($this->request->post['type'] == 'pop3') {
try {
@ -47,6 +48,26 @@ class ControllerImportTest extends Controller {
}
else if($this->request->post['type'] == 'imap') {
try {
$conn = new Zend_Mail_Protocol_Imap($this->request->post['server'], '143', false);
$login = $conn->login($this->request->post['username'], $this->request->post['password']);
if($login) {
print "<span class=\"text-success\">" . $lang->data['text_connection_ok'] . "</span> ";
} else {
print "<span class=\"text-error\">" . $this->request->post['username'] . ": " . $lang->data['text_login_failed'] . "</span> ";
}
} catch (Zend_Mail_Protocol_Exception $e) {
print "<span class=\"text-error\">" . $this->request->post['server'] . ": " . $lang->data['text_connection_failed'] . "</span> ";
}
}
else {
print "<span class=\"text-error\">" . $lang->data['text_error'] . "</span> ";
}

View File

@ -25,7 +25,15 @@
<input type="hidden" name="id" id="id" value="<?php print $id; ?>" />
<?php } ?>
<input type="hidden" name="type" id="type" value="pop3" />
<div class="control-group">
<label class="control-label" for="type"><?php print $text_type; ?>:</label>
<div class="controls">
<select name="type" id="type">
<option value="pop3"<?php if(isset($a['type']) && $a['type'] == 'pop3') { ?> selected="selected"<?php } ?>>pop3</option>
<option value="imap"<?php if(isset($a['type']) && $a['type'] == 'imap') { ?> selected="selected"<?php } ?>>imap</option>
</select>
</div>
</div>
<div class="control-group<?php if(isset($errors['server'])){ print " error"; } ?>">
<label class="control-label" for="server"><?php print $text_server_name; ?>:</label>

View File

@ -25,7 +25,15 @@
<input type="hidden" name="id" id="id" value="<?php print $id; ?>" />
<?php } ?>
<input type="hidden" name="type" id="type" value="pop3" />
<div class="control-group">
<label class="control-label" for="type"><?php print $text_type; ?>:</label>
<div class="controls">
<select name="type" id="type">
<option value="pop3"<?php if(isset($a['type']) && $a['type'] == 'pop3') { ?> selected="selected"<?php } ?>>pop3</option>
<option value="imap"<?php if(isset($a['type']) && $a['type'] == 'imap') { ?> selected="selected"<?php } ?>>imap</option>
</select>
</div>
</div>
<div class="control-group<?php if(isset($errors['server'])){ print " error"; } ?>">
<label class="control-label" for="server"><?php print $text_server_name; ?>:</label>