thanks Sardzent for your work ... i succeed installing the auto-response tab but i have some problems and after a lot of hours i decided to post here. Hoping you could help me ....
i ve followed your instructions , but i've always the same message :'Autoreponder active but no text provided.'
I succedeed connecting your pluggin with Hmail server . On roundcube i can see my vacation settings ("message" and "checkbox") but what ever i do, when i press save button i get this message.
I'm working with Rcube RC2 maybe it's the problem , well i've tried many times but without success...
On my test i've noticed that it could came from the check box (how we know if the checkbox is checked or not ?) the return answer seem to be always unchecked.
Or The other option could came from this line
if (rcmail_sauve_autoreply(
get_input_value('activation_autoreply', RCUBE_INPUT_POST),
get_input_value('message_autoreply', RCUBE_INPUT_POST)))
I have another question : where can i find the definition of rc functions (like "RCUBE_INPUT_POST").
Below my code it could help:
/////////FONCTION DE SAUVEGARDE ET INJECTION DES DONNEES///////
function rcmail_sauve_autoreply($active, $message){
global $DB, $CONFIG, $OUTPUT;
$id_autorep= $_SESSION['username'];
@ $DB_1 = new mysqli('localhost', 'userdatabase', 'pass_secure', 'hmail');
if (mysqli_connect_errno()) {
return false;
}
$RESULT_1 = $DB_1->query('UPDATE hm_accounts SET accountvacationmessageon =\'' . $active . '\', accountvacationmessage =\'' . $message . '\', mod_date=NOW() WHERE accountaddress = \'' . $id_autorep . '\'');
if ( $RESULT_1 ) {
return true;
} else {
return false;
}
$DB_1->close();
}
/////////FORMULAIRE TEMPLATE///////
function rcmail_autoreply_form($attrib){
global $DB, $CONFIG, $OUTPUT;
$id_autorep= $_SESSION['username'];
list($form_start, $form_end) = get_form_tags($attrib, 'sauve-autoreply');
unset($attrib['form']);
if (!$attrib['id'])
$attrib['id'] = 'rcmSavautoreply';
/////////RECUPERATION DES DONNEES///////
@ $DB_1 = new mysqli('localhost', 'userdatabase', 'pass_secure', 'hmail');
$RESULT_1 = $DB_1->query('SELECT accountvacationmessageon , accountvacationmessage FROM hm_accounts WHERE accountaddress = \'' . $id_autorep . '\'');
$ROWS_1 = $RESULT_1->num_rows;
if ( $ROWS_1 == 1 ) {
$ROW_3 = $RESULT_1->fetch_assoc();
$got_accountvacationmessageon = $ROW_3['accountvacationmessageon'];
$got_accountvacationmessage = $ROW_3['accountvacationmessage'];
} else {
$got_accountvacationmessageon = 0;
$got_accountvacationmessage = '';
}
$DB_1->close();
$attrib['name'] = $attrib['id'];
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));
$a_show_cols = array('activation_autoreply' => array('type' => 'checkbox', 'label' => 'activation_autoreply'),
'message_autoreply' => array('type' => 'textarea', 'size' => "300", 'rows' => "6")
);
$out = "$form_start
\n\n";
$field_id = 'activation_autoreply';
$attrib['id'] = $field_id;
$value = rcmail_get_edit_field($field_id, $got_accountvacationmessageon, $attrib, 'checkbox');
$out .= sprintf(" | %s |
\n",
$field_id,
Q(rcube_label('activeautoreply')),
$value);
//
$field_id = 'message_autoreply';
$attrib['size'] = "60";
$attrib['rows'] = "8";
$attrib['id'] = $field_id;
$value = rcmail_get_edit_field($field_id, $got_accountvacationmessage, $attrib, 'textarea');
$out .= sprintf(" | %s |
\n",
$field_id,
Q(rcube_label('textautoreply')),
$value);
$out .= "\n
$form_end";
return $out;
}
/////////CONTROLE DU BOUTON ENVOIE ///////
if ($_action=='sauve-autoreply') {
if ( (($_POST['activation_autoreply']) == 1) && (strlen($_POST['message_autoreply']) < 2 ) ) {
$OUTPUT->show_message('autoreplytoolow', 'error');
} else {
if (rcmail_sauve_autoreply(get_input_value('activation_autoreply', RCUBE_INPUT_POST), get_input_value('message_autoreply', RCUBE_INPUT_POST)))
$OUTPUT->show_message('autoreplymodified', 'confirmation');
else
$OUTPUT->show_message('noautoreply', 'error');
}
rcmail_overwrite_action('autoreply');
}
parse_template('autoreply');
?>
Many users are looking for this pluggin to use it with Hmail server , it could help many users....
thanks for your help ....
running RC2/Hmail Server