Solved

Sendmail mail forwarding

Posted on 2010-09-24
6
409 Views
Last Modified: 2012-05-10

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”.
0
Comment
Question by:farzanj
  • 3
  • 2
6 Comments
 
LVL 26

Assisted Solution

by:jar3817
jar3817 earned 375 total points
ID: 33753319
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
 
LVL 4

Assisted Solution

by:Tachion
Tachion earned 125 total points
ID: 33753406
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
 
LVL 26

Assisted Solution

by:jar3817
jar3817 earned 375 total points
ID: 33753541
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 31

Author Comment

by:farzanj
ID: 33753586
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
 
LVL 26

Accepted Solution

by:
jar3817 earned 375 total points
ID: 33753788
It's a sendmail milter. This will explain much of it: http://www.mimedefang.org/static/mimedefang-lisa04.pdf
0
 
LVL 31

Author Closing Comment

by:farzanj
ID: 33777879
Thank you experts!  All the recommendations are acceptable.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question