The Mailbox persists users' Inbox, Sent Items, Trash... folders with their mails.
The Mail Repository Store persists spam, error,... mails, so nothing to do with users visible mails.
In case of database access, both Mailbox and Mail Repository Store use database connection defined via database.properties.
Apache James Server uses the Apache James Mailbox storage system to store the users mailboxes.
The mailbox library supports different persistence mecanisms: MailDir, Database (via JPA).
Mailbox persistence is configured in spring-beans.xml (by default JPA, you set the database connection properties in database.properties - can also be MailDir).
Mail repository allow the administrator to store mail being processed in the mailet-container. The mails are typically added by the ToRepository mailet. Then for Guice wiring webAdmin API allows to read, delete and reprocess these mails.
Typical use cases might be:
Available Mail Repository Store are defined in mailrepositorystore.xml. Each has an URL prefix (file, db, dbfile,...) that can be used in mailetcontainer.xml to define where to store spam,... mails (example: file://var/mail/error/).
More information about the mailstores configuration can be found here.
Mail Repository Stores are distinguished by how they store data. There are five types of storage: File, Database, DBFile.
Read more on how to configure domain persistence.
Read more on how to configure users persistence.