0

I need to forward all messages received on one server to another server (Exchange box). I know how to forward for an individual, but I am unable to forward for all addresses to their respective destination. The usernames are all the same, as is the domain name.

I've seen tons of documentation online for user-based procmail files, but global procmailrc documentation is scarce.

Again, this is for a GLOBAL procmailrc file that will affect all users. None of the recipients have home directories on the Linux box for which I would create individual procmail files (which is also an administrative nightmare).

EDIT:

To sum up - how do I create a global procmailrc that forwards mail for all users?

Edit 2 (Environment): Debian Squeeze Postfix Microsoft Exchange 2003

2 Answers2

2

Oh now I see. That's an easy one. Reading the manual of procmail it states:

   If  no rcfiles and no -p have been specified on the command line, proc-
   mail will, prior to reading $HOME/.procmailrc, interpret commands  from
   /etc/procmailrc  (if  present).   Care  must  be  taken  when  creating
   /etc/procmailrc, because, if circumstances permit, it will be  executed
   with  root  privileges  (contrary  to  the  $HOME/.procmailrc  file  of
   course).

And in that /etc/procmailrc you forward mails as in every procmailrc:

:0
!some.user@example.local
mailq
  • 17,023
  • 2
  • 37
  • 69
  • I saw that, but it still doesn't explain how to universally forward a message. – Larry G. Wapnitsky Oct 19 '11 at 19:52
  • @LarryG.Wapnitsky Better that way? – mailq Oct 19 '11 at 20:19
  • so I'd still have to manually enter EVERY e-mail address? – Larry G. Wapnitsky Oct 20 '11 at 12:04
  • @LarryG.Wapnitsky Who said that? You have full power of procmail and can read configuration of files, databases, whatever. But that wasn't the question. – mailq Oct 20 '11 at 12:13
  • but this isn't answering my question. I don't want to create multiple configuration files for each user. They don't have home directories, and the number of users fluctuates in terms of manageability. I don't know the software and am trying to learn. Your answers are vague and not very helpful, but seem more intent on making me feel like I shouldn't have asked in the first place. As stated earlier, I've spent a few hours poring through documentation and have been thoroughly confused, which is why I asked for help, not vagueness – Larry G. Wapnitsky Oct 20 '11 at 12:36
  • @LarryG.Wapnitsky The answers are as vague as the questions. You asked how to setup a global procmailrc and got the correct(!) answer. You didn't ask for what to put in the procmailrc so you get no answer for that. – mailq Oct 20 '11 at 12:40
  • I thought this was pretty clear: how do I create a global procmailrc that forwards mail for all users? Telling me to read the docs and putting simplistic answers isn't helping any. I'm even following up with questions, and you're just answering me with more "go do it yourself". The point of this forum is to ask for help and investigate questions. – Larry G. Wapnitsky Oct 20 '11 at 13:02
  • 1
    This is not (!!!) a forum, it is a Q&A site. A question gets answered and is archived. If you have follow-up questions, you should post them as new questions. The Q&A principle works well **because** it is different from a forum where technical problems would cause discussions which tend to get off-topic soon. – the-wabbit Oct 20 '11 at 22:05
  • sorry - used "forum" in the overall sense of the word, not the web-defined version. – Larry G. Wapnitsky Oct 24 '11 at 13:24
  • Upvoted, as this answers the question exactly and succinctly; but really, this should come with a huge warning. You are basically insane to want this. Instead, fix your mail routing in the DNS or configure this in your mail server directly. Delivering and then forwarding introduces several problems; you should transport the message using SMTP until the final destination, and only then deliver it. – tripleee May 16 '20 at 11:41
1

Do you need the messages delivered on the Linux host in the first place? If not, you could set up your MTA so it would simply forward all mail to the Exchange box without trying to deliver it locally, hence without any need for local forwarding via procmail.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
  • The ultimate goal is to have the Linux box strip attachments of a certain size, save them to an FTP site, then forward the message along to the original recipient with a link to the FTP site. I've posted this question before and apparently wasn't clear enough. I've also been recommended to use Python Milter, but don't have the time to learn Python right now. – Larry G. Wapnitsky Oct 19 '11 at 13:12
  • You would not need procmail for this. There are plenty similar setups with walkthroughs on the net, [here is one using simple postfix content filters](http://tech.jeffri.es/2010/09/automatic-ripping-and-saving-email-attachments-with-postfix/) to do the job. Since you mention milters, you are probably using Sendmail (it is good style to describe your software environment instead of letting your readers make guesses BTW) - a similar setup should be possible with Sendmail as well, but presumably at a much greater level of complexity. – the-wabbit Oct 19 '11 at 21:28
  • I am using postfix. THe only reason I mentioned milters was they were suggested as an idea to me a while back. Environment specs added above – Larry G. Wapnitsky Oct 20 '11 at 12:05
  • I see. So what's wrong with content filters then? – the-wabbit Oct 20 '11 at 12:16
  • syneticon - i'm new to the linux-side of mail processing, so I'm going with what I've been able to figure is the best solution first. I could be very wrong – Larry G. Wapnitsky Oct 20 '11 at 12:34
  • With procmail you are putting the cart before the horse. Procmail will fire as the message is locally delivered to your system. Concluding from your problem description, you only want to use the postfix system as a filter, finally delivering all messages to an exchange server. Just using the postfix content filter mechanism is by far more elegant than invoking procmail. – the-wabbit Oct 20 '11 at 15:22
  • I will look into that. I will test over the next few days and report back. Thank you. – Larry G. Wapnitsky Oct 20 '11 at 17:39