Thx for answering so quickly, I tried this in a new package inside james-server-container-spring project... I have a public static void main(String[] args) containing my private staticMailboxManager mailboxManager which is injected with the annotation @Resource(name="mailboxmanager") from the spring-bean.xml. But it does not succeed in initializing the variable and I get a NullPointerException as soon as I use it... How can I initialize my beans without running the entire James app?
Tks. 2011/1/19 Eric Charles <e...@apache.org> > Hi Luc, > > Yes, code has changed in trunk since M2 (we don't use MailServer anymore). > In M2, or in trunk, the way to store mail is the same. > If you are deploying the your code/class in the james spring container, you > need to inject the mailboxmanager (with @Resources(name="mailboxmanager") > and have a block of code such as: > > MailboxPath mailboxPath = MailboxPath.inbox(userName30); > MailboxSession mailboxSession = > mailboxManager.createSystemSession(userName30, log) > MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, > mailboxSession); > messageManager.appendMessage(your-input-stream, > new Date(), > mailboxSession, > isRecent, > flags); > mailboxManager.endProcessingRequest(mailboxSession); > } > > I just realize I can't find a simple test case to in trunk to show this (or > maybe I didn't look good). > If we don't have this, maybe you could open a jira so we can further > provide test samples. > (this comes from the fact that all our tests were made from an "imap > perspective", we moved the imap test to another project, but we probably > should further enrich the pure mailbox test cases/samples). > > Tks, > > Eric > > > > > On 19/01/2011 18:04, Luc Sauličre wrote: > >> Hello, >> I'm developing with Math on the same mail app. We didn't succeed in >> storing >> mail as james3 does. In fact the SieveMailet class does not have a >> setUsersRepo method, I think you're dealing with a newer version of >> James3... >> We are developing with the M2 one and SieveMailet have a setMailserver >> method instead. >> So, is there any way to store a mail (from another IMAP connection for >> instance) in the James3 mySQL db, as James3 does (i.e. filling correctly >> all >> the appropriate tables...)? >> >> Thx for helping. >> Luc. >> >> 2011/1/17 Eric Charles<e...@apache.org> >> >> Hi, >>> The mails store magic occurs in LocalDelivery where the MailboxManager is >>> injected. >>> (more precise, LocalDelivery uses the SieveMailet initialized with the >>> MailboxManager) >>> sieveMailet.setUsersRepository(usersRepository); >>> sieveMailet.setMailboxManager(mailboxManager); >>> sieveMailet.init(m); >>> sieveMailet.setQuiet(true); >>> ... >>> if (mail.getState() != Mail.GHOST) { >>> sieveMailet.service(mail); >>> } >>> >>> You only need to know that *MailRepository is not for users' mail storage >>> http://james.apache.org/server/3/feature-persistence.html >>> >>> Both topics (mailet usage for delivery + separate mail stores) are >>> subject >>> to discussion will certainly change. >>> >>> Tks, >>> >>> Eric >>> >>> >>> >>> On 17/01/2011 11:43, math math wrote: >>> >>> Hello everybody, >>>> >>>> I am developping a web mail project using james 3M2. I'm trying to store >>>> mails in a "james3" way with an external application using MySql DB. >>>> I've >>>> tried to store mails using mysq database repositories for a few days now >>>> but >>>> i didn't succeed to do so... I 've traced the store method of >>>> JDBCMailRepository class and also the ToRepository one. But still don't >>>> know >>>> how James 3 is storing mails in the DB. >>>> >>>> I would be very glad if someone could help me in this task. >>>> >>>> Thanks, >>>> Mat >>>> >>>> >>>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org >>> For additional commands, e-mail: server-dev-h...@james.apache.org >>> >>> >>> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org > For additional commands, e-mail: server-dev-h...@james.apache.org > >