Prev: Disable Connection Cache for local filters
Next: Using -o smtpd_end_of_data_restrictions=check_policy_serviceunix:private/policy not working in master.cf
From: Alex on 19 May 2010 07:50 Hi, Where can I go to find information on how to modify the content of the body of an email before delivering? I would like to experiment with changing "curse words" or removing URLs like "<a href=....>" ? I realize there are all kinds of problems with doing this, such as modifying the signature and size of messages, but it's acceptable tradeoff for now. I'd really like to be able to do this with a perl script rather than having to install some additional program like amavisd. Maybe something like alterMIME? Thanks, Alex
From: Noel Jones on 19 May 2010 08:37 On 5/19/2010 6:50 AM, Alex wrote: > Hi, > > Where can I go to find information on how to modify the content of the > body of an email before delivering? > > I would like to experiment with changing "curse words" or removing > URLs like "<a href=....>" ? > > I realize there are all kinds of problems with doing this, such as > modifying the signature and size of messages, but it's acceptable > tradeoff for now. > > I'd really like to be able to do this with a perl script rather than > having to install some additional program like amavisd. Maybe > something like alterMIME? > > Thanks, > Alex You can use smtp_header_checks and smtp_body_checks with the REPLACE action to make minor changes to mail content during delivery. These are rather simple tools by design, best suited for easily defined transformations. IIRC altermime is better suited for removing attachments or adding disclaimers. I don't think it will help with replacing words or URLs. There are some regexp based milters that may give you more control. Enjoy your experiment, but in the end you're much better off rejecting messages with content you don't like rather than trying to fix it. -- Noel Jones
From: Alex on 19 May 2010 16:30 Hi, > You can use smtp_header_checks and smtp_body_checks with the REPLACE action > to make minor changes to mail content during delivery. These are rather > simple tools by design, best suited for easily defined transformations. Thanks for the notes. If I were to do it the right way, how would I go about it? Is it possible to strip the entire HTML content and pass only the text? Perhaps the right way to say it would be to pass only the MIME text and strip everything else? Thanks again, Alex
From: Noel Jones on 19 May 2010 17:39 On 5/19/2010 3:30 PM, Alex wrote: > Hi, > >> You can use smtp_header_checks and smtp_body_checks with the REPLACE action >> to make minor changes to mail content during delivery. These are rather >> simple tools by design, best suited for easily defined transformations. > > Thanks for the notes. If I were to do it the right way, how would I go about it? > > Is it possible to strip the entire HTML content and pass only the > text? Perhaps the right way to say it would be to pass only the MIME > text and strip everything else? > Yes, you can probably do something like that with MIMEDefang. -- Noel Jones
From: Jeroen Geilman on 19 May 2010 19:08
On 05/19/2010 10:30 PM, Alex wrote: > Hi, > > >> You can use smtp_header_checks and smtp_body_checks with the REPLACE action >> to make minor changes to mail content during delivery. These are rather >> simple tools by design, best suited for easily defined transformations. >> > Thanks for the notes. If I were to do it the right way, how would I go about it? > > Is it possible to strip the entire HTML content and pass only the > text? Perhaps the right way to say it would be to pass only the MIME > text and strip everything else? > > Thanks again, > Alex > I found this fantastic little util called "mailtextbody" - it does just that: strips off all non-text parts and leaves a clean, text-only message. Really, content processing should be left to non-MTA programs. |