Theres a thread in here, from I and Andrew, with the same query, one moment...
here it is, and if you look, you might find another, not sure
Thanks for the thread pointer. After poking around in the MailboxService class, there appears to be some logic that determines if a given messageBody is orphaned or not. This only gets called from the expunge() function, which appears to deal with expunging a folder, mostly from the IMAP code.
However, I don't see anything like this happening in the UserApi (org.jboss.mail.userapi.MailSender) when a message gets deleted. The MessageData gets deleted, but not the Messagebody (directly at least).
Is there some kind of automatic expunge happenin at a scheduled time, or on some other call? Otherwise it seems like the webmail would be creating orphaned message bodies.
I think, at least with 1.4, it creates orphaned bodies, thas why Andrew recommended, you right a cron Job, or something similar, to expunge the bodies...
if your looking for something, to handle it for you within JBoss, you might look, or search for jboss scheduler, as it seemed it would do nicely for say running a class that just called a sql procedure which deleted orpaned emails...
PS: someone needs to write a patch...but I my self, suck at hibernate, I looked at it once, and have shied away since! Should learn it though!