2

I need to forward e-mails to different mail accounts by different conditions. The aim is to create mail notification scheme for my company. I'd like to setup server on dedicated mail domain for it. Is there any software that helps to get my aim (Linux)?

Examples:

1) forward all e-mail sent to [email protected] to x@x, y@y, z@z (no conditions)

2) forward e-mail sent to [email protected] where subject contains '[finance]' to a@b and b@b

3) forward e-mail sent to [email protected] where subject contains '[fault]' to s@s and s2@s.

Receivers' domains are different.

P.S. Now we use Gmail filters to get this functionality, but it's unstable and hard to maintain.

1
  • Yes, every MTA is capable of diong this, but it's probably simpler and safer to implement the logic with an MDA such as procmail.
    – symcbean
    Dec 7, 2012 at 10:29

2 Answers 2

3

You may use procmail. It's invokation is usually integrated in your MTA, so if you just create a configuration file, it will be used.

A skeleton of the rule you may write is:

:0  # forward if finance
* ^Subject:.*[finance].*
! a@b,b@b

For more information have a look at http://userpages.umbc.edu/~ian/procmail.html

4
  • It's not so easy if subject header is encoded (quoted-printable). But I found some solution for this cases: benya.com/procmail/#subjectdecode Dec 7, 2012 at 11:01
  • You are right, not that easy :-( But I still think this is the simplest solution.
    – eppesuig
    Dec 7, 2012 at 11:06
  • As the result I wrote Exim MTA filter for mail forwarding with my conditional tests. There is only one problem that still is not resolved. When sending messages from [email protected] to my virtual maillist forwarded message is not returned to [email protected]. But exim logs says that the message is sent. So this message disappears in some unknown place... Other tested mail services works fine without this issue. Dec 8, 2012 at 18:37
  • I got better results by using group {:0 c} -style forwarding. Simply listing the delivery addresses didn't work correctly. Nov 22, 2020 at 10:24
-1

Did you want this server just to do the forwarding, or will people be connecting to it to pick up their mail?

If you were after a fully-fledged mailserver with a lot of features, Zimbra Collaboration Suite is very good. There's an open source edition that's free, and it can do the fowarding you want server-side via the admin interface (https). Users can make use of things like a global address list for the domain if they're using Webmail or the Zimbra Desktop client (free also).

Although you said Linux, I thought I'd mention a Windows mailserver named MDaemon. It has a feature called DomainPOP which I thought was pretty strange but is exactly what you're after. http://www.redline-software.com/eng/support/docs/mdaemon/c13.php

Use DomainPOP Mail Collection (Setup DomainPOP…, or F8) to configure MDaemon to download mail from a remote POP mailbox for redistribution to your users. This feature works by using the POP protocol to download all the mail found in the ISP's POP mailbox associated with the specified logon. Once collected, the messages are parsed according to the settings provided on this dialog and then placed in user mailboxes or the remote mail queue for MDaemon to deliver, just as if the messages had arrived at the server using conventional SMTP transactions.

I worked at a place that was using that and the emails which arrive appear to be from the original sender... so when the final recipient hits Reply, it goes to the intended recipient instead of the mailbox at the forwarding point.

1
  • Thanks. All I need is just forwarding, no mailboxes and mail storage. Variant with DomainPOP brings unwanted delay. Dec 7, 2012 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .