[Dovecot] Sendmail + Deliver for virtual domains via /etc/procmailrcs scripts

Andrzej Adam Filip andrzej.filip at gmail.com
Thu Jun 11 20:36:33 EEST 2009


Recipe for delivery to virtual dovecot domains via procmail scripts

1) sendmail.mc lines [recompile it to sendmail.cf]

FEATURE(`mailertable')
FEATURE(`virtusertable')
MAILER(`procmail')
LOCAL_CONFIG
dnl File to keep non local domains processed via virtusertable
F{VirtHost}/etc/mail/virtual-domains

2) mailertable lines [recompile it with makemap program]

# deliver messages to example.net domain via procmail script
# /etc/procmailrcs/example.net.rc
# procmail treats scripts in /etc/procmailrcs in special way
# if executed as root changes uid to uid of the script file owner
example.net procmail:/etc/procmailrcs/example.net.rc

3) access (database/file) lines [recompile it with makemap program]

# accept messages addressesed to example.net from anywhere
to:example.net RELAY

4) /etc/mail/virtual-domains file

example.net

5) Check that example.net *IS NOT* listed on list on local email domains

echo '$=w' | sendmail -bt

If it is then 
5a) disable auto-detection of local email domains
http://www.sendmail.org/m4/tweaking_config.html#confDONT_PROBE_INTERFACES
5b) add local domains missing after turning off auto-detection manually
    [as mentioned in http://www.sendmail.org/faq/section4#4.5 ]


As I wrote it is a little bit messy and requires many different entries
for single virtual domain but no patching of *.m4 files is required.

P.S.
*IF* you add the line below to sendmail.mc 
  define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_')
*THEN* you can list existing dovecot virtual users in virtusertable and
reject remaining addresses

user1 at example.net %0
user2 at example.net %0
@example.net error:nouser User Unknown

-- 
[pl>en: Andrew] Andrzej Adam Filip : anfi at onet.eu
You can't play your friends like marks, kid.
  -- Henry Gondorf, "The Sting"


More information about the dovecot mailing list