I have been doing some experimentation and digging around on writing mailets and have
a design question.... First, let me state that my mailets are designed to respond
based on a match of the mail recipient's name, i.e. a mail sent to
[EMAIL PROTECTED] . Given the basic layout of config.xml, I set it so that
I, the postmaster, would be notified of any errors that occurred, or if a message was
marked as spam. When I sent a mail to one of my mailets, the mailet handles the mail
message OK, but the mail eventually gets passed on from the transport processor to the
error processor and I the postmaster get notified that an error occurred in processing
the mail/mailet. EVEN THOUGH no error really occurred. This is because the mailet id
is not really a registered user.
To get around this, I then tried adding the mailet's recipient name to my list of
local users. This stopped the error report to the postmaster, as expected, but the
drawback is that now every mail message sent to my mailets gets stored in the
database, awaiting the "user/mailet" to pick it up... Since that won't ever happen,
the net result will be an ever increasing storage of mail ,sent to mailets, into the
database. That doesn't sound like a good design either...
I dug further and took a look at the class ToRepository because that mailet has a
boolean parameter in the config.xml file called "passThrough" and it aroused my
suspicison. In the service method of ToRepository I discovered that if the passThrough
parameter is false, then the Mail state is set to Mail.GHOST Is this the proper way
for a mailet to consume a Mail message and stop the Mail message from being passed on
from one processor/mailet to another? If not, maybe some kind soul will give me a bit
of guidance here, as I am a bit confused... ;-)
If my suspicions are correct, and the Mail state needs to be set to Mail.GHOST then
maybe this is a design issue that should be refereed to the James developers. I would
argue that the GenericMailet class ought to supply a default implementation of the
passThrough parameter so that this behavior could be inherited in subclassed
Mailets.... (I am really scared of my mailets knowing about ghosts! ;-) )
Marc Chamberlin.....
----------------------------------------------------------------------------------------------------------------
Do you think the software industry will ever make software that is as easy and
reliable for a user to use
as the automobile industry makes a car easy and reliable for a user to drive?
----------------------------------------------------------------------------------------------------------------
A man said unto the universe - "Sir, I exist!"
"However," replied the universe "I do not see where that creates in me a sense of an
obligation."
- Stephen Crane