You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@james.apache.org by alex_rosstech <al...@rosstech.biz> on 2007/11/26 14:32:48 UTC

inject to spool from outside james?

Hi all!

I was wondering if it was possible to inject emails into james' spool from a
program which is external to james? In other words, I want to write a simple
Java program which pops mail from a server and injects these into james'
root processor. I don't want to use fetchmail, as configuring this for many
users is not feasible.

I guess I could just write the emails to james' spool directory, but I'm not
sure how to generate the required Repository.FileObjectStore files.

Any help would be much appreciated!

Thanks!
-- 
View this message in context: http://www.nabble.com/inject-to-spool-from-outside-james--tf4874852.html#a13948649
Sent from the James - General mailing list archive at Nabble.com.


Re: ToRepository from outside james?

Posted by Danny Angus <da...@apache.org>.
If you use a db repository for the spool you can inject messages using
SQL, what to set the fields to is pretty self-evident, and trial and
error should reveal the rest.
Or you could use Java-mail to just "send" them to James using SMTP.

d.

On 26/11/2007, alex_rosstech <al...@rosstech.biz> wrote:
>
> Hi all!
>
> I was wondering if it was possible to inject emails into james' spool from a
> program which is external to james? In other words, I want to write a simple
> Java program which pops mail from a server and injects these into james'
> root processor. I don't want to use fetchmail, as configuring this for many
> users is not feasible.
>
> I guess I could just write the emails to james' spool directory, but I'm not
> sure how to generate the required Repository.FileObjectStore files.
>
> Any help would be much appreciated!
>
> Thanks!
> --
> View this message in context: http://www.nabble.com/ToRepository-from-outside-james--tf4874852.html#a13948649
> Sent from the James - General mailing list archive at Nabble.com.
>
>

Re: inject to spool from outside james?

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Nov 28, 2007 7:44 PM, Robert Burrell Donkin
<ro...@gmail.com> wrote:
> On Nov 28, 2007 1:52 PM, alex_rosstech <al...@rosstech.biz> wrote:
> >
> >
> > robert burrell donkin-2 wrote:
> > >
> > > though avalon is no longer state-of-the-art, it is a IoC container and
> > > the JAMES services are basically POJOs (plus some extra glue required
> > > by avalon). there is no reason to rewrite the configuration file when
> > > you can just (re)-configure directly (from Java).
> > >
> >
> > Robert, could you give me a pointer as to how to achieve the
> > (re)-configuration from java?
> > I didn't know this was possible, and
> > http://www.nabble.com/re-reading-configuration-files-tf38742.html#a105344
> > this thread  suggested it was not possible.
>
> JAMES does not support hot re-deployment of SARs but JAMES uses IoC
> and the underlying components are essentially POJOs and can be
> reconfigured programmatically

one option would to add to the existing JMX instrumentation

- robert

Re: Defining Other Repositories

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Nov 29, 2007 4:37 AM, David Jones <af...@bellsouth.net> wrote:
> List:
>
>
> I am new to JAMES and am evaluating if it is a good fit for solving my
> Java solution. Where can I find more information about configuring
> repositories.
>
> Question:
> Defining Other Repositories: for specific categories (Ex
> ItemsToBeApproved and Etc)
>
> The configuration below does not add the expected repository
>
>      <inboxRepository>
>         <repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
>         <repository
> destinationURL="file://var/mail/itemstobeapprovedboxes/" type="MAIL"/>
>      </inboxRepository>

inboxRepository stores user INBOXs. my expectation is that each user
can only have one INBOX. i would therefore expect only one INBOX to be
created by the above.

BTW this mailing list is for discussion of issues related to running
the JAMES project. you may well get a better response for questions
like this on the user list. see http://james.apache.org/mail.html.

- robert

Defining Other Repositories

Posted by David Jones <af...@bellsouth.net>.
List:


I am new to JAMES and am evaluating if it is a good fit for solving my 
Java solution. Where can I find more information about configuring 
repositories.

Question:
Defining Other Repositories: for specific categories (Ex 
ItemsToBeApproved and Etc)

The configuration below does not add the expected repository

     <inboxRepository>
        <repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
        <repository 
destinationURL="file://var/mail/itemstobeapprovedboxes/" type="MAIL"/>
     </inboxRepository>

Thanks



Re: inject to spool from outside james?

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Nov 28, 2007 1:52 PM, alex_rosstech <al...@rosstech.biz> wrote:
>
>
> robert burrell donkin-2 wrote:
> >
> > though avalon is no longer state-of-the-art, it is a IoC container and
> > the JAMES services are basically POJOs (plus some extra glue required
> > by avalon). there is no reason to rewrite the configuration file when
> > you can just (re)-configure directly (from Java).
> >
>
> Robert, could you give me a pointer as to how to achieve the
> (re)-configuration from java?
> I didn't know this was possible, and
> http://www.nabble.com/re-reading-configuration-files-tf38742.html#a105344
> this thread  suggested it was not possible.

JAMES does not support hot re-deployment of SARs but JAMES uses IoC
and the underlying components are essentially POJOs and can be
reconfigured programmatically

- robert

Re: inject to spool from outside james?

Posted by alex_rosstech <al...@rosstech.biz>.

robert burrell donkin-2 wrote:
> 
> though avalon is no longer state-of-the-art, it is a IoC container and
> the JAMES services are basically POJOs (plus some extra glue required
> by avalon). there is no reason to rewrite the configuration file when
> you can just (re)-configure directly (from Java).
> 

Robert, could you give me a pointer as to how to achieve the
(re)-configuration from java?
I didn't know this was possible, and 
http://www.nabble.com/re-reading-configuration-files-tf38742.html#a105344
this thread  suggested it was not possible.
Thank you for your time!
-- 
View this message in context: http://www.nabble.com/inject-to-spool-from-outside-james--tf4874852.html#a13992741
Sent from the James - General mailing list archive at Nabble.com.


Re: inject to spool from outside james?

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Nov 28, 2007 8:57 AM, alex_rosstech <al...@rosstech.biz> wrote:
>
>
> robert burrell donkin-2 wrote:
> >
> > i suggest that you take a look at the fetchmail source code. fetchmail
> > runs as a periodic task and then inserts mail into the spool.
> >
> > FetchScheduler (1) loads the configuration and sets up the scheduling.
> > MessageProcessor (2) injects mail into the spool (see sendMail).
> >
>
> That looks very interesting. I first discarded the idea of using fetchmail,
> because I need to have quite a lot of pop servers to pop from, and to be
> able to add new ones dynamically without having to restart james. But I
> could programmatically write the fetchmail config file..... then all I need
> is to be able to re-initialize the FetchScheduler programmatically.....do
> you know if this is possible? I'll look into it now...

though avalon is no longer state-of-the-art, it is a IoC container and
the JAMES services are basically POJOs (plus some extra glue required
by avalon). there is no reason to rewrite the configuration file when
you can just (re)-configure directly (from Java).

- robert

Re: inject to spool from outside james?

Posted by alex_rosstech <al...@rosstech.biz>.

robert burrell donkin-2 wrote:
> 
> i suggest that you take a look at the fetchmail source code. fetchmail
> runs as a periodic task and then inserts mail into the spool.
> 
> FetchScheduler (1) loads the configuration and sets up the scheduling.
> MessageProcessor (2) injects mail into the spool (see sendMail).
> 

That looks very interesting. I first discarded the idea of using fetchmail,
because I need to have quite a lot of pop servers to pop from, and to be
able to add new ones dynamically without having to restart james. But I
could programmatically write the fetchmail config file..... then all I need
is to be able to re-initialize the FetchScheduler programmatically.....do
you know if this is possible? I'll look into it now...

Thanks for your input!

Alex

-- 
View this message in context: http://www.nabble.com/inject-to-spool-from-outside-james--tf4874852.html#a13988370
Sent from the James - General mailing list archive at Nabble.com.


Re: inject to spool from outside james?

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Nov 27, 2007 4:19 PM, alex_rosstech <al...@rosstech.biz> wrote:
>
>
> alex_rosstech wrote:
> >
> >  Do you know of any way to trigger james to process the messages in the
> > spool? Simply sending another email through james doesn't work either.
> >
> I suppose I could write the emails to a different folder/repository, and
> then send regular "control" emails which call the FromRepository mailet to
> then fetch and inject these mails into the spool?

i suggest that you take a look at the fetchmail source code. fetchmail
runs as a periodic task and then inserts mail into the spool.

FetchScheduler (1) loads the configuration and sets up the scheduling.
MessageProcessor (2) injects mail into the spool (see sendMail).

- robert

1. http://svn.apache.org/repos/asf/james/server/trunk/fetchmail-function/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
2. http://svn.apache.org/repos/asf/james/server/trunk/fetchmail-function/src/main/java/org/apache/james/fetchmail/MessageProcessor.java

RE: inject to spool from outside james?

Posted by alex_rosstech <al...@rosstech.biz>.

alex_rosstech wrote:
> 
>  Do you know of any way to trigger james to process the messages in the
> spool? Simply sending another email through james doesn't work either.
> 
I suppose I could write the emails to a different folder/repository, and
then send regular "control" emails which call the FromRepository mailet to
then fetch and inject these mails into the spool?
-- 
View this message in context: http://www.nabble.com/inject-to-spool-from-outside-james--tf4874852.html#a13973893
Sent from the James - General mailing list archive at Nabble.com.


RE: inject to spool from outside james?

Posted by alex_rosstech <al...@rosstech.biz>.

Steve Brewin wrote:
> 
> Ideally you should programatically inject your mail into James spool and
> let
> James take care of the rest. If the current SMTP and fetchmail injectors
> do
> not meet your needs, you could write your own using their source code as a
> reference.
> 

Thanks for getting back to me Steve! I have managed to "inject" emails into
the spool! :-) Unfortunately, james doesn't pick this up until it is
restarted! Do you know of any way to trigger james to process the messages
in the spool? Simply sending another email through james doesn't work
either.


Steve Brewin wrote:
> 
> james-general is for administrative issues. You will get a better response
> from james-user where, if you describe what you are trying to achieve, you
> may find other users that have solved your problem. If you want to write
> your own spool injector, ask questions on james-dev.
> 
Sorry about that! I tried moving the thread to the "James - Dev" forum, but
it didn't allow me to.
Could an admin maybe move it? Sorry again!

alex_rosstech wrote:
>
>
>
> Hi all!
>
> I was wondering if it was possible to inject emails into
> james' spool from a
> program which is external to james? In other words, I want to
> write a simple
> Java program which pops mail from a server and injects these
> into james'
> root processor. I don't want to use fetchmail, as configuring
> this for many
> users is not feasible.
>
> I guess I could just write the emails to james' spool
> directory, but I'm not
> sure how to generate the required Repository.FileObjectStore files.
>
> Any help would be much appreciated!
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/inject-to-spool-from-outside-james--tf48
74852.html#a13948649
Sent from the James - General mailing list archive at Nabble.com.






-- 
View this message in context: http://www.nabble.com/inject-to-spool-from-outside-james--tf4874852.html#a13972844
Sent from the James - General mailing list archive at Nabble.com.


RE: inject to spool from outside james?

Posted by "Noel J. Bergman" <no...@devtech.com>.
It would be best to NOT write directly to the spool, unless we decide to
publish a libjames that includes such a method.  JAMES can be instructed,
instead, to pickup messages from an external source.  The latter has the
great benefit of permitting evolution (or revolution) in ours spooling
engine.

	--- Noel