You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Edward Tan <ta...@gmail.com> on 2005/12/27 20:02:57 UTC

Trying to get the filename in var/mail/inboxes/usermailbox programmatically

Hi,

Is there anyway to get the message filename in user's mailbox for a mailet?

I notice that the email message will be stored in
var/mail/inboxes/usermailbox after all the mailets are processed. So it
seems that I need to change James internal code so that when it stores the
message into var/mail/inboxes/usermailbox I can store the filename
somewhere.

The question is which part of the code (class) that is responsible in
storing message (MIME) into var/mail/inboxes/usermailbox.

The filename under var/mail/inboxes/usermailbox looks like this:

4D61696C313133353730393537323734332D3131.Repository.FileObjectStore
4D61696C313133353730393537323734332D3131.Repository.FileStreamStore


Every email will have two files under var/mail/inboxes/usermailbox

In the mailet I can get the mail Id something like this

Mail1135709310983-10

I need to make an association between

Mail1135709310983-10

and

4D61696C313133353730393537323734332D3131.Repository.FileObjectStore
4D61696C313133353730393537323734332D3131.Repository.FileStreamStore


How can I do this?

Thanks in advance

Regards,
Edward

Re: Trying to get the filename in var/mail/inboxes/usermailbox programmatically

Posted by Edward Tan <ta...@gmail.com>.
Hi,

Thanks.

I have found the solution already.

Inside James.java -> storeMail(...) method:

        userInbox.store(mailImpl);

mailImpl is the mail in user inbox repo. At the same time if I go up in the
function call, somewhere the old mail in spool repo was processed before set
to null when it is GHOSTED. So I just need to remember the Mail id
(getName()) and pass to associating function after userInbox.store
(mailImpl).


Thanks.

Cheers,
Edward

On 12/28/05, Stefano Bagnara <ap...@bago.org> wrote:
>
> Edward Tan wrote:
> > [...]
> > in the user mailbox seems not possible since the file pair in the user
> > mailbox has not been created when the mailet is processing the mail.
> >
> > Any idea how I can make the association of mail Id during mailet
> processing
> > with filename of the file pair in user mailbox?
>
>
> The name is automatically generated by the filepair. There's no way to
> know it in advance.
>
> You probably need to create your own implementation of file repository
> using your own naming/format.
>
> What's your goal? Why do you need to know the file name? Probably the
> right way is totally different.
>
> Stefano
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>

Re: Trying to get the filename in var/mail/inboxes/usermailbox programmatically

Posted by Stefano Bagnara <ap...@bago.org>.
Edward Tan wrote:
> [...]
> in the user mailbox seems not possible since the file pair in the user
> mailbox has not been created when the mailet is processing the mail.
> 
> Any idea how I can make the association of mail Id during mailet processing
> with filename of the file pair in user mailbox?


The name is automatically generated by the filepair. There's no way to
know it in advance.

You probably need to create your own implementation of file repository
using your own naming/format.

What's your goal? Why do you need to know the file name? Probably the
right way is totally different.

Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Trying to get the filename in var/mail/inboxes/usermailbox programmatically

Posted by Edward Tan <ta...@gmail.com>.
After I drilled down James codes. I found that the email message was in
spool when the mailet is processing. And the message is stored in filepair
(where the filename is generated by
org.apache.james.mailrepository.filepair.AbstractFileRepository.java) in the
spool directory.

Once the mailet chain finished processing, another thread (?) will move this
pair of file into user mailbox directory and generate a new pair of files.

So to make the association of mail id like

Mail1135709310983-10

with the filename

4D61696C313133353730393537323734332D3131.Repository.FileObjectStore

in the user mailbox seems not possible since the file pair in the user
mailbox has not been created when the mailet is processing the mail.

Any idea how I can make the association of mail Id during mailet processing
with filename of the file pair in user mailbox?

Of course, one idea is to do it after all is over using POP3 UIDL combined
with linear searching of UIDL for every file in user mailbox with extension
.Repository.FileObjectStore. But this is very ugly mechanism.

Anyone's help will be very much appreciated.

Regards,
Edward

On 12/28/05, Edward Tan <ta...@gmail.com> wrote:
>
> Hi,
>
> Is there anyway to get the message filename in user's mailbox for a
> mailet?
>
> I notice that the email message will be stored in
> var/mail/inboxes/usermailbox after all the mailets are processed. So it
> seems that I need to change James internal code so that when it stores the
> message into var/mail/inboxes/usermailbox I can store the filename
> somewhere.
>
> The question is which part of the code (class) that is responsible in
> storing message (MIME) into var/mail/inboxes/usermailbox.
>
> The filename under var/mail/inboxes/usermailbox looks like this:
>
> 4D61696C313133353730393537323734332D3131.Repository.FileObjectStore
> 4D61696C313133353730393537323734332D3131.Repository.FileStreamStore
>
>
> Every email will have two files under var/mail/inboxes/usermailbox
>
> In the mailet I can get the mail Id something like this
>
> Mail1135709310983-10
>
> I need to make an association between
>
> Mail1135709310983-10
>
> and
>
> 4D61696C313133353730393537323734332D3131.Repository.FileObjectStore
> 4D61696C313133353730393537323734332D3131.Repository.FileStreamStore
>
>
> How can I do this?
>
> Thanks in advance
>
> Regards,
> Edward
>