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 He...@icw.de on 2007/10/10 14:09:53 UTC

move mails from error to spool

Hi,

what do I have to do, so that I can respool my mails?
The mails end up in /var/mail/error as ...FileObject- and 
...FileStreamStore files. After I have repaired the cause of the error 
(connection problems ...) I would like to bring them into the system
again.

In order to do that, I stopped James and moved all the files from the 
error into
the /var/mail/spool directory and started James again. Only to find out 
that all
files are in the error directory again. The logs showed the following:

10/10/07 13:41:51 DEBUG spoolmanager: ==== Begin processing mail 
Mail1191835011822-3====
10/10/07 13:41:51 DEBUG spoolmanager: Processing Mail1191835011822-3 
through error
10/10/07 13:41:51 DEBUG spoolmanager.error: Servicing mail: 
Mail1191835011822-3
10/10/07 13:41:51 DEBUG spoolmanager.error: Checking Mail1191835011822-3 
with org.apache.james.transport.matchers.All@1d8c528
10/10/07 13:41:51 DEBUG spoolmanager.error: Servicing Mail1191835011822-3 
by ToRepository Mailet
10/10/07 13:41:51 INFO  James.Mailet: ToRepository: Storing mail 
Mail1191835011822-3 in file://var/mail/error/
10/10/07 13:41:51 DEBUG spoolmanager: Processed Mail1191835011822-3 
through error
10/10/07 13:41:51 DEBUG spoolmanager: Result was ghost
10/10/07 13:41:51 DEBUG spoolmanager: ==== Removed from spool mail 
Mail1191835011822-3====

Alternatively, I moved just the '...StreamStore'-file into the spool
directory. It got just deleted without any trace in the log.

What is the correct procedure to achieve my goal? Do I have to change 
something
in the files, move it into a different directory ...?

TIA, Heinz-Dieter

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


Re: move mails from error to spool

Posted by Stefano Bagnara <ap...@bago.org>.
Heinz-Dieter.Conradi@icw.de ha scritto:
> That has been my next step - but I failed.
> That was my configuration:
> 
>     <processor name="root">
>            [...]
>          <mailet match="All" class="FromRepository">
>              <repositoryPath>file://var/mail/hdc/</repositoryPath>
>              <processor>transport</processor>
>              <delete>true</delete>
>          </mailet>
> 
> But I do not see that anything is happening. Inserting log messages into
> the FromRepository class revealed that the 'service' method is not called
> (initializing is happening and the repository does point to an existing
> directory as verified in the log).

Where did you added the mailet match="All" ? Are you sure that some mail
is hitting this mailet at all?
Please make use of a matcher (the IsRecipient is a good candidate) and
place this mailet at the top of the root processor.

Stefano



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


Re: move mails from error to spool

Posted by He...@icw.de.
Hi,

> > what do I have to do, so that I can respool my mails?
> > The mails end up in /var/mail/error as ...FileObject- and 
> > ...FileStreamStore files. After I have repaired the cause of the error 

> > (connection problems ...) I would like to bring them into the system
> > again.
> 
> There are 2 files for each email.
> One is the mail source stream, the other is metadata about the Mail.
> In the metadata there is the "State".
> When a message is read from a spool, its State is read and the processor
> with the same name is then used to process the mail. The processor
> usually change the state to something else so that the next "spool run"
> will take care of the next action.
> 
> To set an error to a message you set the State to error, so it will be
> processed by the "error" processor that simply save it to a specific
> repository and set the state to "ghost" ("ghost" is a special state to
> tell the spooler to delete the mail).
> 
> If you move the mail from the error repository to the spool then the
> mail will keep its "error" state, and the spooling will start from the
> error processor, that will push it back to the error repository.
> 
> You have to make sure the "state" of the message is resetted to "root"
> and you can't do this altering manually the file. So you have to use the
> FromRepository mailet. In the current trunk code we added commands to
> the remotemanager to move mails between repositories, but this is not
> available in any released version, yet, sorry.
> 

Thanks Stefano.
This confirms, what I had thought by looking at code and the files -
unfortunately.

> so you add something like:
> <mailet match="RecipientIs=respoolerrors@localhost" 
class="FromRepository">
>   <repositoryPath>your error repository</repositoryPath>
>   <processor>root</processor>
>   <delete>true</delete>
> </mailet>
> 
> Sending a mail to respoolerrors@localhost will respool that mails.

That has been my next step - but I failed.
That was my configuration:

    <processor name="root">
           [...]
         <mailet match="All" class="FromRepository">
             <repositoryPath>file://var/mail/hdc/</repositoryPath>
             <processor>transport</processor>
             <delete>true</delete>
         </mailet>

But I do not see that anything is happening. Inserting log messages into
the FromRepository class revealed that the 'service' method is not called
(initializing is happening and the repository does point to an existing
directory as verified in the log).

> 
> IMPORTANT: you should understand why that mails are in error, because
> most time respooling them will not work and will end up in the same
> error again.

Of course ;-) 
That's why I used a special directory not just the error one.

Heinz-Dieter

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


Re: move mails from error to spool

Posted by Stefano Bagnara <ap...@bago.org>.
Heinz-Dieter.Conradi@icw.de ha scritto:
> Hi,
> 
> what do I have to do, so that I can respool my mails?
> The mails end up in /var/mail/error as ...FileObject- and 
> ...FileStreamStore files. After I have repaired the cause of the error 
> (connection problems ...) I would like to bring them into the system
> again.

There are 2 files for each email.
One is the mail source stream, the other is metadata about the Mail.
In the metadata there is the "State".
When a message is read from a spool, its State is read and the processor
with the same name is then used to process the mail. The processor
usually change the state to something else so that the next "spool run"
will take care of the next action.

To set an error to a message you set the State to error, so it will be
processed by the "error" processor that simply save it to a specific
repository and set the state to "ghost" ("ghost" is a special state to
tell the spooler to delete the mail).

If you move the mail from the error repository to the spool then the
mail will keep its "error" state, and the spooling will start from the
error processor, that will push it back to the error repository.

You have to make sure the "state" of the message is resetted to "root"
and you can't do this altering manually the file. So you have to use the
FromRepository mailet. In the current trunk code we added commands to
the remotemanager to move mails between repositories, but this is not
available in any released version, yet, sorry.

so you add something like:
<mailet match="RecipientIs=respoolerrors@localhost" class="FromRepository">
  <repositoryPath>your error repository</repositoryPath>
  <processor>root</processor>
  <delete>true</delete>
</mailet>

Sending a mail to respoolerrors@localhost will respool that mails.

IMPORTANT: you should understand why that mails are in error, because
most time respooling them will not work and will end up in the same
error again.

Stefano


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