You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Enrique Rodriguez <en...@25oz.com> on 2004/03/07 06:46:27 UTC

Mailman Bridge Mailet

Hi, James Developers,

I wrote a first draft of a "Mailman Bridge Mailet" and have attached it. 
  I would really appreciate feedback on the use of the Mailet API, as 
well as any comments/criticism on style, format, or Java usage.

The MailmanBridge Mailet "pipes" mail to Mailman.  The intent is for 
James to be used as the MTA in (former) Postfix and Sendmail 
environments.  Each line of what was once an /etc/aliases alias mapping 
can now be represented as a mailet block in James' config.xml.  What was 
formerly:

list-announce:         "|/var/mailman/mail/mailman post list-announce"

can now be expressed as:

<mailet match="RecipientIs=list-announce@localhost.localdomain" 
class="MailmanBridge">
     <debug>false</debug>
     <passThrough>false</passThrough>
     <runAs>mail</runAs>
     <wrapperPath>/var/mailman/mail/mailman</wrapperPath>
     <program>post</program>
     <argument>list-announce</argument>
</mailet>

I currently have it running on two personal lists and so far so good.

As for enhancements, I plan on reworking the config, so the XML is less 
verbose and, hopefully, to reduce the sheer number of Mailets, since it 
currently operates as one Mailet per Mailman alias.

I built it against the latest from CVS, which identifies as "James Mail 
Server 3.0a1."  This Mailet drops into 
org.apache.james.transport.mailets and I call 'ant' to build it right 
into the distribution.  I am running it on Fedora Core 1 with 
mailman-2.1.4 and j2sdk1.4.2_03.

-enrique

RE: Mailman Bridge Mailet

Posted by "Noel J. Bergman" <no...@devtech.com>.
> > Why MailmanBridge?  Seems to be generic, so why not
> "PipedProcess" or some such?

> Because I was planning to add functionality that was specific to
> Mailman, to simplify the configuration of large numbers of lists

Ah.  Might make sense to factor it out into a base class with a protected
method for acquiring the command line to be processed.

As for your configuration change, I think you're going about it wrong.  Take
a look at the new mailing list manager in branch_2_1_fcs, and see how it
uses an external XML file, and pattern substitution.

	--- Noel


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


Re: Mailman Bridge Mailet

Posted by Enrique Rodriguez <en...@25oz.com>.
Noel J. Bergman wrote:
>><mailet ... class="MailmanBridge">
> 
> Why MailmanBridge?  Seems to be generic, so why not "PipedProcess" or some
> such?

Because I was planning to add functionality that was specific to 
Mailman, to simplify the configuration of large numbers of lists, such 
as the config change I discuss, below.  PipedProcess will be a good 
name, along with the <command> simplification, if I can't get the new 
config working.

>>   <runAs>mail</runAs>
>>   <wrapperPath>/var/mailman/mail/mailman</wrapperPath>
>>   <program>post</program>
>>   <argument>list-announce</argument>
> 
> Why not just:
>    <command> /var/mailman/mail/mailman post list-announce </command>
> or
>    <command> sudo -u mail /var/mailman/mail/mailman post list-announce
> </command>
> 
> Which you are otherwise generating internally.

I broke out the command into elements because I was hoping to do this, 
which would make having lots of lists easier:

<mailet match="RecipientIs=announce@localhost, discuss@localhost" 
class="MailmanBridge">
     <debug>true</debug>
     <passThrough>false</passThrough>
     <runAs>mail</runAs>
     <wrapperPath>/var/mailman/mail/mailman</wrapperPath>
     <list name="announce">
         <alias program="post">announce</alias>
         <alias program="mailowner">announce-admin</alias>
         <alias program="mailcmd">announce-request</alias>
     </list>
     <list name="discuss">
         <alias program="post">discuss</alias>
         <alias program="mailowner">discuss-admin</alias>
         <alias program="mailcmd">discuss-request</alias>
     </list>
</mailet>

This also has the side benefit of reducing the number of mailets 
initialized.

I see how, for example, RemoteManager works with Configuration's.  Is 
this somehow possible from Mailets?  I'd like to use getInitParameter() 
with xpath, but the parameters appear restricted to a single level of 
XML with no attributes?

I will refactor to fix the thread-safety and reduce the use of global 
variables.  In addition to being bad form, I understand the 
mailet/container interaction better.  Thanks for the pointers.

-enrique

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


RE: Mailman Bridge Mailet

Posted by "Noel J. Bergman" <no...@devtech.com>.
> list-announce:         "|/var/mailman/mail/mailman post list-announce"

> <mailet ... class="MailmanBridge">

Why MailmanBridge?  Seems to be generic, so why not "PipedProcess" or some
such?

>    <runAs>mail</runAs>
>    <wrapperPath>/var/mailman/mail/mailman</wrapperPath>
>    <program>post</program>
>    <argument>list-announce</argument>

Why not just:

   <command> /var/mailman/mail/mailman post list-announce </command>

or

   <command> sudo -u mail /var/mailman/mail/mailman post list-announce
</command>

Which you are otherwise generating internally.

	--- Noel


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