Autor: Mar Matthias Darin Fecha: A: Jaap Winius Cc: Exim-users Asunto: Re: [exim] Pre-processing incoming mail
Hello,
Jaap Winius writes:
> Hi list,
>
> What would be the best way to pre-process incoming messages? By this I
> mean that I'd like to single out certain messages and run one or more
> search-and-replace routines over them before they're delivered.
>
> For instance, I could write a perl script with some regular expressions
> to do what I want, but then how would I get Exim to pipe these messages
> through my script before delivery? Or would PCRE be a better choice?
>
> Any suggestions would be much appreciated. Examples welcome too.
This is easy is one way, difficult in another. Here is the approach I use:
1. Tell exim to save in /var/spool/maildir
this is not the real mail box area. I use both mbox and maildir. Maildir
is easier for your needs, single message per file.
2. Use a script to scan the messages the way you want them.
Bash/sed or Perl or anything else for that matter. I use this method for
virus scanning/pgp signatures/spam control.
3. Each userf must a .forward pointing to the real mail area. Call exim in
the script to complete the delivery.
I use the following:
# Exim filter
save /var/spool/mail/MailDir/$local_part/
save /var/spool/mail/$local_part.backup
This method is simple and to the point. The script is the difficult part.