Easy Postfix & Scalix integration PDF Print E-mail
Written by Mogamat Abrahams   
Thursday, 19 June 2008 07:03
---------------------------------------

1. Disable Sendmail, as per Scott in Scalix Wiki/HowTos/Complete_Postfix it is best not to completely remove Sendmail as package management depends on it.

service sendmail stop
chkconfig --level 2345 sendmail off

2. Get and install Postfix

yum install postfix

3. edit /etc/postfix/main.cf, replace <your smart relay> with the name of your ISP's SMTP server.

inet_interfaces = loopback-only
local_recipient_maps =
relayhost = <your smart relay>
mynetworks = 127.0.0.0/8
transport_maps = ldap:/etc/postfix/ldap-transport.cf, ldap:/etc/postfix/ldap-transport2.cf

You may also want to add :
my_origin=yourdomain.com
replacing yourdomain.com with your domain name. This is just in case you are sending mail from other unix processes on the box, which would normally be rejected as they are not listed in the scalix recipient map (defined below)

4. Add /etc/postfix/ldap-transport.cf   - to lookup valid recipient names from the Scalix Directory service

bind = no
query_filter = (&(mail=%s)(omUlClass=*))
result_format = lmtp:[127.0.0.1]:24
result_attribute = omMailnode
debuglevel = 0

5. Add /etc/postfix/ldap-transport2.cf:

bind = no
query_filter = (&(mail=catchall@%d)(omUlClass=*))
result_format = lmtp:[127.0.0.1]:24
result_attribute = omMailnode
debuglevel = 0


6. Edit your /var/opt/scalix/XXXX/s/sys/smtpd.conf file to turn on lmtp and to add a catchall user, this is for catching mail to unrecognised local users from within Scalix :

LMTP=ON

CATCH @<yourdomain.com> sxadmin@<yourdomain.com>


6. For each domain you host, add an entry for a catchall user to any Scalix user which should receive lost emails for that domain. So if your domain is popo.com and you want any unmatched emails to go to This e-mail address is being protected from spambots. You need JavaScript enabled to view it , add an alias This e-mail address is being protected from spambots. You need JavaScript enabled to view it in SAC for the sxadmin user. This ensures that postfix will send all mail for recognised domains to scalix.

7. Test by sending a mail from the console

''mail This e-mail address is being protected from spambots. You need JavaScript enabled to view it ''
Subject: ''A tEst''
''lineklsjdksjlasjkd
alsjkdlkasjd
laksjdls''
Cc: This e-mail address is being protected from spambots. You need JavaScript enabled to view it

You should get a mail in your sxadmin account and in the external mailbox. If not tail -f /var/log/maillog is your friend ;-) If this is a dedicated server and a new setup, you may also want to add

root:  This e-mail address is being protected from spambots. You need JavaScript enabled to view it

to /etc/aliases, so that emails to root actually go somewhere meaningfull.

8. Most likely you want to setup fetchmail to download your domain mailbox over pop3 and inject into Postfix.
    Install fetchmail:

yum install fetchmail

    Edit /etc/fetchmail.conf

set daemon 300
poll yourexternalamailhost.com
    protocol pop3                                                                               
   localdomains yourdomainname.com

   envelope Envelope-to
   user ext_mail_username with password ext_mail_password to * here
   
    For some strange reason, there is no init.d script for fetchmail on CENTOS 5, I borrowed the one from a CENTOS 4 machine which seems to work ok.
         /etc/init.d/fetchmail :
 #!/bin/sh
#
# Startup script for fetchmail
#
# chkconfig: 2345 99 01
# description: A software package for fetching mail from remote servers.
# processname: fetchmail
# pidfile: /var/run/fetchmail.pid
# config: /etc/fetchmail

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0

nicename="Fetchmail"
pidfile="/var/run/fetchmail.pid"
args="-f /etc/fetchmail.conf --syslog"
prog="fetchmail"
RETVAL=0

# See how we were called.
case "$1" in
  start)
        echo -n $"Starting $prog: "
        daemon $prog $args
        echo
        RETVAL=$?
        ;;
  stop)
        echo -n $"Stopping $prog: "
        killproc $prog
        echo
        /bin/rm -f $pidfile
        RETVAL=$?
        ;;
  status)
        ;;
  restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  *)
        echo "Usage: $prog {start|stop|restart|reload|status}"
        exit 1
esac

exit $RETVAL

Once the files are in place, you can do : service fetchmail start . Be sure to tail /var/log/messages just in case there are any booboos you did not catch. You may also want to set soft_bounce=yes in /etc/postfix/main.cf and add keep at the end of /etc/fetchmail.conf

9. If it all works, congratulations, pat yourself on the back!
Last Updated on Thursday, 19 June 2008 07:08