Sendmail mail forwarding

Using sendmail/ procmail, how would you forward emails sent to user joe@localhost to forward to joe@remotehost, unless the email is larger than 1Mb or it has a Subject line that  includes the string “From Uncle Sam”.
LVL 31
Who is Participating?
jar3817Connect With a Mentor Commented:
It's a sendmail milter. This will explain much of it:
jar3817Connect With a Mentor Commented:
It's been a LONG time since I've used procmail...but this should be close:

* ^To: joe@localhost
      * !^Subject: From Uncle Sam
      * < 1000000
      ! joe@remotehost
TachionConnect With a Mentor Commented:
This is not really answering your question directly, BUT, instead of doing this with procmail, you may want to consider "sieve". It allows you do to that and a whole lot more. See:

We use this with postfix, but a previous setup used it with procmail. It is a whole lot more user friendly than the archaic procmail language.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

jar3817Connect With a Mentor Commented:
If you're a perl guy you can use Mimedefang too with sendmail. I use this on my mail gateways and it gives you programmatic access to every step of the SMTP exchange.
farzanjAuthor Commented:
Hi Jar3817,
Yes, I know Perl but could you please give me a more specific answer about how to use Mimedefang.  Never used this particular library.
farzanjAuthor Commented:
Thank you experts!  All the recommendations are acceptable.
All Courses

From novice to tech pro — start learning today.