output->type != 'html') { return; } $js_addition_spam_folders = json_encode($this->addition_spam_folders); $js_suspicious_folders = json_encode($this->suspicious_folders); $script = << -1) { props.disp.spam = false; props.disp.ham = true; } else if ($.inArray(rcmail.env.mailbox, suspicious_folders) > -1) { props.disp.spam = true; props.disp.ham = true; // from here it is also possible to alter the buttons themselves... props.objs.spamobj.find('a > span').text('As possibly spam'); } else { props.objs.spamobj.find('a > span').text(rcmail.get_label('markasjunk.markasjunk')); } return props; }); EOL; $rcmail->output->add_script($script, 'docready'); } public function spam(&$uids, $mbox) { // Treat message as spam... } public function ham(&$uids, $mbox) { // Treat message as ham... } }