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
farzanjAsked:
Who is Participating?
 
jar3817Connect With a Mentor Commented:
It's a sendmail milter. This will explain much of it: http://www.mimedefang.org/static/mimedefang-lisa04.pdf
0
 
jar3817Connect With a Mentor Commented:
It's been a LONG time since I've used procmail...but this should be close:

:0hb
* ^To: joe@localhost
{
      :0HB
      * !^Subject: From Uncle Sam
      * < 1000000
      ! joe@remotehost
}
0
 
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: http://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)
and http://www.fastmail.fm/docs/sieve/

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.
0
Never miss a deadline with monday.com

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.
0
 
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.
0
 
farzanjAuthor Commented:
Thank you experts!  All the recommendations are acceptable.
0
All Courses

From novice to tech pro — start learning today.