[sam] Trouble with spam_extension drop-down list
Josh Endries
josh at endries.org
Thu Jan 13 08:46:37 PST 2005
Hello,
I'm using amavisd-sql and having trouble with the spam_extention
drop-down mailbox list option. We have a Cyrus backend. I modified
the default list a little to only include the user's mailboxes
(INBOX.*, not shared mailboxes like user.*). This is what I have in
attributes.php:
if ($GLOBALS['registry']->hasMethod('mail/folderlist')) {
$mailboxes = $GLOBALS['registry']->call('mail/folderlist');
}
if ($mailboxes && !is_a($mailboxes, 'PEAR_Error')) {
$_attributes['spam_extension'] = array(
'label' => _("File spam Into Mailbox:"),
'type' => 'enum',
'required' => false,
'params' => array(array())
);
$_attributes['spam_extension']['params'][0][] = '';
foreach ($mailboxes as $mbox) {
if ($mbox['val'] != 'INBOX' &&
strpos($mbox['val'],'INBOX',0) !== FALSE) {
$_attributes['spam_extension']['params'][0][] =
str_replace('INBOX.','',$mbox['val']);
}
}
}
I added a blank option at the top in case they want to turn it off;
I didn't see a way to do it otherwise. The problem is: in SQL it is
setting the addr_extension_spam column to the index of the array,
such as 0 for the top option, 1, 2, 3, etc., rather than the name of
the mailbox (INBOX, spam, Sent, etc). The form's <select> has values
equal to these indices, rather than the name, is this correct? I
would think it would use the name of the mailbox, since that's what
you want after the extension ("+" for me) character.
What should I change to get this working correctly?
Thanks,
Josh
More information about the sam
mailing list