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 Philip Tomlinson <ph...@pot.co.nz> on 2006/04/02 12:30:10 UTC

getting mail context from another thread

Hi,
How can I get a MailContext from another thread other than a spool thread.

I have a scheduler which calls back in a separate thread of execution 
and from this thread
I want to be able to send an email.

Rgds,
Phil






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


Re: getting mail context from another thread

Posted by Stefano Bagnara <ap...@bago.org>.
Philip Tomlinson wrote:
> Hi,
> How can I get a MailContext from another thread other than a spool thread.
> 
> I have a scheduler which calls back in a separate thread of execution 
> and from this thread
> I want to be able to send an email.

You have to work with the assembly.xml

Add the dependency "org.apache.mailet.MailetContext" to your scheduler 
component (it is provided by the James block).

You can then simply use the ServiceManager (in your component service() 
method) to lookup the MailetContext.

You have to add the dependency by declaring it in your component .xinfo 
file.

Stefano


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