Re: Change default junk folder

"Scoopta via server-user" <[email protected]>
Newsgroups gmane.comp.jakarta.james.user
Message-ID <[email protected]>
Well I don't really want dynamic behavior, my ideal situation is to just 
have all accounts use Junk as the folder name so I don't have to do 
that, but if that's not really a supported setup then I'm left with 
either dynamic folders or migrating all my existing accounts to using 
the Spam folder, neither of which are ideal IMO.

On 8/10/26 12:14 AM, Quan tran hong wrote:
> Hi,
>
>> My main concern isn't the clients as they are using spam
> correctly, it's all my mailet rules on the server for what folders to
> send spam to that are my problem. They are targeting the junk folder by
> name
>
> Simple solution in my opinion: change them to target Spam mailbox, and have
> old user adapt from Junk to Spam.
>
>> is there a better way to setup my mailets to dynamically pick the
> right folder without having to write something custom?
>
> If you insist on this dynamic behavior, we can leverage logic customization
> in *mailetcontainer.xml.*
>
> E.g., if the mail is spam and the recipient has the Junk mailbox (old
> users), then store the mail in Junk. Otherwise, store in the Spam mailbox.
>
> ```xml
> <matcher name="spam-and-junk-exists"
>           match="org.apache.james.mailetcontainer.impl.matchers.And">
>    <matcher match="IsMarkedAsSpam"/>
>    <matcher match="MailboxExists=Junk"/>
> </matcher>
>
> <matcher name="spam-and-junk-does-not-exist"
>           match="org.apache.james.mailetcontainer.impl.matchers.And">
>    <matcher match="IsMarkedAsSpam"/>
>    <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>      <matcher match="MailboxExists=Junk"/>
>    </matcher>
> </matcher>
>
> <mailet match="spam-and-junk-exists" class="WithStorageDirective">
>    <targetFolderName>Junk</targetFolderName>
> </mailet>
>
> <mailet match="spam-and-junk-does-not-exist"
>          class="WithStorageDirective">
>    <targetFolderName>Spam</targetFolderName>
> </mailet>
> ```
>
> Note: MailboxExists would need to be implemented as a custom matcher,
> because it is not currently one of James’s standard matchers. It would
> check mailbox existence separately for each recipient.
>
> Quan
>
>
> On Mon, Aug 10, 2026 at 12:05 PM Scoopta via server-user <
> [email protected]> wrote:
>
>> I went from 3.7.5 to 3.9.0 a little earlier this year, however I've been
>> running this james setup continuously since 2017 so my oldest accounts
>> are quite old. My main concern isn't the clients as they are using spam
>> correctly, it's all my mailet rules on the server for what folders to
>> send spam to that are my problem. They are targeting the junk folder by
>> name, is there a better way to setup my mailets to dynamically pick the
>> right folder without having to write something custom?
>>
>> On 8/9/26 8:57 PM, Quan tran hong wrote:
>>> Hi,
>>>
>>> I guess you migrated from a very old version of James. As I know, James
>> has
>>> used Spam as the default mailbox name for several years.
>>>
>>> There is no supported configuration setting to rename the default
>>> mailboxes, as far as I know. The default mailbox names are hardcoded in
>>> DefaultMailboxes.
>>>
>>> I recommend using the built-in Spam mailbox for new accounts. Although
>> its
>>> visible name is Spam, James exposes the appropriate special-use
>> semantics:
>>> IMAP \Junk and JMAP role junk. Clients should therefore rely on the
>>> special-use metadata or role rather than the literal mailbox name.
>> Existing
>>> Junk mailboxes can be kept as legacy folders. For migration, you could
>> move
>>> the existing messages from *Junk* to *Spam*.
>>>
>>> If you really insist on not creating the Spam mailbox for new accounts,
>>> provisionDefaultMailboxes=false can disable automatic provisioning, but
>> it
>>> does not provide a way to rename Spam to Junk.
>>>
>>> I hope it helps.
>>>
>>> Regards,
>>>
>>> Quan
>>>
>>> On Mon, Aug 10, 2026 at 9:28 AM Scoopta via server-user <
>>> [email protected]> wrote:
>>>
>>>> I noticed in more recent versions of james the default junk folder is
>>>> now spam, this isn't ideal since I have a lot of existing accounts that
>>>> use the junk folder name, I don't want new accounts to use a different
>>>> folder name, how can I adjust the default folder creation settings?
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.