Re: [exim] Stripping mail to plain text for mailing lists

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Dennis Davis
Date:  
À: exim-users
Sujet: Re: [exim] Stripping mail to plain text for mailing lists
On Fri, 28 Oct 2005, Kevin Colagio wrote:

> From: Kevin Colagio <colagio@???>
> To: exim-users@???
> Date: Fri, 28 Oct 2005 09:13:25 -0400
> Subject: [exim] Stripping mail to plain text for mailing lists
>
> 'Morning!


Good afternoon :-)

> We have a few mailing lists that have requested to receive mail that is plain
> text only, stripping out all attachments, "fancy stuff" (bullets, etc..), and
> making mail what (us old-timers ;) ) think e-mail should be.
>
> I haven't found anything in Exim to do this, but I've come up with some ideas
> and I need a knowledgeable body to bounce them to...so here goes...
>
> 1) Setup a lookup file that has a list of "plain text only" requesters.
> 2) Setup a router that checks the incoming mail against that list
> 2a) If they are on the list, send the message to a transport that will de-mime
> it.
> 2b) If they are not on the list, continue to next router.
> 3) Deliver the message to the mailing list as normal, demimed if they were on
> the list.


What happens if you get a message that arrives for two recipients,
one in each category? What do you do then? There are ways round
this that have been discussed on this list before. One way, as
others have suggested, is to get the mailing software to do the
demining.

> Now, a few options that fall out of this...
> 1) If the mail goes to recipient-mime, it goes through without being demimed.
> 2) recipient-demime (regardless of being on the list) are always demimed.
>
> So if this theory is right....? ...then what I could use is help setting it
> up. I do plan on using demime ( http://scifi.squawk.com/demime.html ) to do
> the processing.
>
> <puts on his dunce cap>
> My big "I'm not sure how it works..." is this: What's the flow
> of a message through the routers to the transport and back to
> the routers? Does it start at the top again or continue where it
> "broke out"? If it varies, a breakdown of when/where it changes
> would help a lot. The other thing I'm not sure of is if I send
> something to a pipe, how does it get back into the mailing system
> after modification?
> </removes dunce cap>


You could possibly do the demining as part of the transport. Read
up on the generic transport_filter option for transports. I
haven't used a transport filter for anything this complex. But the
following:


# Some crapware MUA clients will include null bytes in messages.
# This variant of the above transport strips out any null bytes
# when delivering mail to the Cyrus IMAP server. This should avoid
# triggering Cyrus's strict checking. We don't use this transport
# all the time for efficiency reasons.
#
# Not this may not be the right thing to do if messages have been
# digitally signed etc. However anyone smart enough to do this
# should also be smart enough to not use a crapware MUA client.
cyrus_ltmp_filter_nulls:
driver = smtp
protocol = lmtp
transport_filter = /usr/bin/tr -d \\000

...


works a treat when delivering email to a Cyrus IMAP server.
-- 
Dennis Davis, BUCS, University of Bath, Bath, BA2 7AY, UK
D.H.Davis@???               Phone: +44 1225 386101