mdforward allows mail to be deliverd to mailboxes (frequently then acessed via POP3), to maildirs, to programs. Mail may also be deleted or bounced.
Mailboxes are used for "local" delivery of mail that is to be read via POP or a local mail program such as pine.
Currently mdforward only supports "Berkely mbox" format mail files. This includes operating systems such as FreeBSD, NetBSD, OpenBSD, and SunOS. Operating systems that require "dot locking" such as HP-UX are not presently supported. Please contact the author if you wish to use mdforward on such a system.
Forwarding, is forwarding, with the only catch that the address of the account that mdforward is installed in must not be used as this causes mail to loop. Write the mail into the local mailbox instead with the first option.
qmail style Maildirs are sensible but few programs yet understand them.
Delivery to programs is appropriate for creating autoresponders and other automated mail processing. A suitable autoresponder is autoreply also written by mdforward's author.
Deliveries are controlled by files in the control directory, typically $HOME/.mdforward.
Delivery instructions are specified one per line so that mail can be forwarded and/or delivered to multiple recipients.
Blank lines in delivery files are ignored, as are lines beginning with a "#" character. Delivery is undertaken in the order lines appear in delivery files, and stops if there is an error. An example appears later in this page.
The locals file tells mdforward what domains you accept mail for. This file should be a list of domain names, one per line. No wildcards are supported, so subdomains must be listed too.
nemeton.com.au subdomain.nemeton.com.au example.com
Aside: this file is only used when the envelope recipient cannot reliably be determined. Sendmail is reluctant to provide the envelope recipient; X-Envelope-To is only sometimes available.
This file specifies fallback delivery instructions, when there are no instructions specific to a user in any of the domain(s) mail is being accepted for.
At least while installing and testing mdforward I recommend that this file be used so that forgotten and overlooked addresses within the domain(s) don't cause mail to be bounced.
Finally in case any mail arrives with no information as to the real user it was destined for, an "unknown" entry may be set up for last resort delivery. Such mail will include Bcc: and some mailing list mail. This control file is therefore practically mandatory.
For each domain in the locals file, create a directory in .mdforward. This directory should be created with its name all in lower case, otherwise it will be ignored.
Within these per-domain directories files are set up for each user that mail should be handled for, plus a default entry that perfoms just like the one discussed above, except only for users in that domain.
User names in these domain directories should be created:
- in lower case
- with "." characters replaced with ":"
.mdforward/nemeton.com.au/giles .mdforward/nemeton.com.au/giles:lean .mdforward/nemeton.com.au/webmaster .mdforward/nemeton.com.au/default .mdforward/example.com.au/someuser
Example: mail to "firstname.lastname@example.org" should be sent onward to a user and a copy kept locally for POP retrieval.
The file .mdforward/nemeton.com.au/webmaster therefore contains:
# an email address, for forwarding email@example.com # this account's Mailbox /var/mail/user
Remember that blank lines and comments are ignored; there are only two delivery instructions here.
The local mail spool might not be /var/mail, check with your system adminsitrator or support people if you are not sure.
The choice of lower case is enforced my mdforward, so that "user", "USER" and "User" are all the same address.
The transliteration of periods to colons is partly a security measure and partly for conformance with qmail on which mdforward's delivery model is modeled.
Users at pair.com will be happy to know that pair.com plan to move to qmail for pair2000, at which point migration from mdforward to qmail's virtual domains will be easy.
For detailed information on what to put in the indivdual files, see the references above.
With this configuration done, you're ready to run the check_control script.
The check_control script is written in perl and will need to be edited to have the path to perl set if your perl binary is not in /usr/local/bin. Run the script by typing its pathname; it will not be in your standard search PATH.
Assuming you are in the .mdforward directory you have created, it can be run like this:
At mdfoward-1.1 the check control script provided no output if it found no errors. At 1.2 and later it says:
check_control: no errors found.
If problems are found full explanations are provided, and you are encouraged to correct them!
Once check_control is not complaining you are ready to turn on mdforward and test it.