Not sure if this is caused by the same problem at JMBAIL-229, but something similar happens in the webmail when one tries to send a message to one's self.
Upon the send, I get this:
17:13:59,828 INFO [AbstractStore] Creating store item
17:13:59,843 INFO [JMSMailListener] PUT MESSAGE ON QUEUE:org.jboss.mail.message.Mail@1272e52
17:14:00,093 ERROR [LocalDelivery] Could not deliver local mail
java.lang.NullPointerException
at org.jboss.mail.store.StoreItemImpl.getSize(StoreItemImpl.java:126)
at org.jboss.mail.message.StoredMailBody.getSize(StoredMailBody.java:172)
at org.jboss.mail.mailbox.MessageData.(MessageData.java:171)
at org.jboss.mail.mailhandler.localmailbox.LocalDelivery.org$jboss$mail$mailhandler$localmailbox$LocalDelivery$deliver$aop(LocalDelivery.java:124)
at org.jboss.mail.mailhandler.localmailbox.LocalDelivery.access$1(LocalDelivery.java)
at org.jboss.mail.mailhandler.localmailbox.LocalDelivery$deliver_7597238674321613949.invokeNext(LocalDelivery$deliver_7597238674321613949.java)
I've nailed this down to the userapi.MailSenderImpl.send(...) function.
The first line creates the mail body (although nothing gets stored to the dbase, verified by inspection). Then the mail is forwarded to the chain, and a null pointer is thrown by the MessageData constructor, because the StoredMailBody doesn't exist in the database (yet).
Looks like the same thing. Doesn't happen every time generally.