Use debconf to configure Exim4 for which domains Exim should consider itself as the final destination. You can do this with the following command:
dpkg-reconfigure plow exim4
Create a file called 700_exim4-config_zarafa in the directory /etc/exim4/conf.d/router. Add the following text in the file:
zarafa:
debug_print = "R: zarafa for $local_part@$domain"
driver = accept
domains = +local_domains
check_local_user
transport = zarafa_pipe
require_files = +/usr/bin/zarafa-dagent
no_verify
no_expn
Create a file called 30_exim4-config_zarafa_pipe in the directory /etc/exim4/conf.d/transport. Add the following lines to the file:
zarafa_pipe:
debug_print = "T: zarafa_pipe for $local_part@$domain"
driver = pipe
path = "/bin:/usr/bin:/usr/local/bin"
command = "/usr/bin/zarafa-dagent $local_part"
return_path_add
delivery_date_add
envelope_to_add
Finally you need to add the following line to the file /etc/exim4/update-exim4.conf:
dc_localdelivery=zarafa_pipe
Now start the update-exim4.conf script and reload Exim4 with the following commands:
update-exim4.conf
etc/init.d/exim4 restart
When you do not have a local MTA configured on the server with Zarafa installed, you need to run the Zarafa-dagent via Fetchmail. In fetchmail configuration file you should at the following option: mda "/usr/sbin/zarafa-dagent username"
See a full example fetchmail configuration below:
poll 192.168.1.254
localdomains zarafa.com
protocol pop3
no dns
username john
password 'password'
to *
smtpaddress zarafa.com
fetchall
forcecr
set postmaster user
mda "/usr/bin/zarafa-dagent john"
The fetchmail configuration should be made for every user individual.
See here for more information about Fetchmail.
To run both Zarafa and Cyrus on a single machine, please follow these steps:
- To use Postfix with multiple transport providers you need to use a transport table. Add the following line to the Postfix master.cf file:
zarafa unix - n n - -
pipe user=vmail argv=/usr/bin/zarafa-dagent ${user}
- Comment the mailbox_command and mailbox_transport in the Postfix main.cf. Add the following line to the Postfix main.cf:
transport_maps = hash:/etc/postfix/transport
- In the file /etc/postfix/transport you can add email addresses with the corresponding transport provider. For example:
m.oostergo@zarafa.com zarafa
j.lewis@zarafa.com cyrus
- After you have made changes to the transport table you need to run the command "postmap /etc/postfix/transport" to create the hash file.
Now all mail for m.oostergo@zarafa.com is delivered to Zarafa and the email for j.lewis@zarafa.com is delivered to Cyrus.
It is possible to configure sendmail to use the zarafa-dagent directly. The configuration files for sendmail can usually be found in /etc/mail, The required m4 files can be found in /usr/share/sendmail/cf or /usr/share/sendmail-cf (the exact location is distribution specific). The instructions below assume the m4 files are located in /usr/share/sendmail/cf/, so please make sure the files created below are stored in the for your distribution correct location.
First, the sendmail zarafa mailer needs to be created. To do this, a new file should be created which contains the data below. This file should be saved to /usr/share/sendmail/cf/mailer/zarafa.m4:
PUSHDIVERT(-1)
#
# Mailer for Zarafa
#
ifdef(`ZARAFA_MAILER_ARGS',,
`define(`ZARAFA_MAILER_ARGS', zarafa-dagent $u)')
ifdef(`ZARAFA_MAILER_PATH',,
`define(`ZARAFA_MAILER_PATH',
/usr/local/bin/zarafa-dagent)')
POPDIVERT
#######################################
### Zarafa Mailer specification ###
#######################################
VERSIONID(`@(#)zarafa.m4 31-Aug-2007')
MZARAFA, P=ZARAFA_MAILER_PATH, F=DFMhu,
S=15, R=25, T=X-Phone/X-ZARAFA/X-Unix,
A=ZARAFA_MAILER_ARGS
LOCAL_CONFIG
CPZARAFA
Secondly, the local_zarafa feature needs to be created. This feature will allow the zarafa-dagent to deliver mail from localhost. Save the data below to /usr/share/sendmail/cf/feature/local_zarafa.m4:
divert(-1)
divert(0)
VERSIONID(`@(#)zarafa.m4 31-Aug-2007')
divert(-1)
ifdef(`_MAILER_local_',
`errprint(`*** FEATURE(local_zarafa) must
occur before MAILER(local)
')')dnl
define(`LOCAL_MAILER_PATH',
ifelse(defn(`_ARG_'), `',
ifdef(`ZARAFA_MAILER_PATH',
ZARAFA_MAILER_PATH,
`/usr/local/bin/zarafa-dagent'),
_ARG_))
define(`LOCAL_MAILER_ARGS',
ifelse(len(X`'_ARG2_), `1', `zarafa-dagent $u', _ARG2_))
undefine(`_LOCAL_PROCMAIL_')
undefine(`_LOCAL_LMTP_')
undefine(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE')
The last part is enabling the Zarafa dagent in sendmail. To enable the Zarafa dagent delivery from localhost, add the following lines to /etc/mail/sendmail.mc:
FEATURE(`local_zarafa')
MAILER(`local')
To enable the Zarafa dagent for all other deliveries add the following lines to sendmail.mc:
MAILER(`zarafa')
After the creation and editing of these files, the configuration needs to be activated. Execute the following command:
sendmailconfig
This will generate the sendmail.cf file and reload sendmail. If the zarafa-spooler was already running, this too needs to be restarted:
/etc/init.d/zarafa-spooler restart
In the postfix configuration file "master.cf", add the following rule:
zarafa unix - n n - - pipe
flags= user=vmail argv=/usr/bin/procmail -a ${user}After that, edit the postfix configuration file "main.cf" and add the following line:
mailbox_transport = zarafa
When that is completed, edit the procmail configuration file "/etc/procmailrc" and add the following lines:
USER=$1
:0w* ^X-Spam-Status: Yes
| zarafa-dagent -j $USER
EXITCODE=$?
:0w
| zarafa-dagent $USER
EXITCODE=$?
After this, restart postfix by issuing the command:
/etc/init.d/postfix reload