XMailServer as MTA
From Zarafa wiki
Using XMailServer as the Zarafa MTA
Using XMailServer in combination with Zarafa is a good solution for several reasons.
- XMail runs on every POSIX platform, it doesn't have many dependencies.
- It is lightweight, powerful, and fast.
- It has its own userbase
- There are many opensoure tools to manage the userbase.
- It is GPL licensed!
How to
- Download Davide Libenzi XMailServer from http://www.xmailserver.org
- Compile and install / configure it on your platform, please see the documentation and community forums for help, and futher instructions.
- Once you have XMailServer up and running, you must setup a filter that will pass all incoming mail, into the zarafa-deamon.
- create the directory /var/MailRoot/filters/zarafa
- create the file /var/MailRoot/filters/zarafa/zarafa.tab, and put the following line in its body
"/var/MailRoot/filters/zarafa/zarafa.php[TAB]@@FILE[TAB]@@RRCPT[TAB]@@RCPT[TAB]@@FROM[ENTER]"
- open the file /var/MailRoot/filters.in.tab and put the following line in its body
"*"[TAB]"*"[TAB]"0.0.0.0/0"[TAB]"0.0.0.0/0"[TAB]"zarafa.tab"[ENTER]
- create the file /var/MailRoot/filters/zarafa/zarafa.php and paste the php code below this text, please edit the source so that it applies to your server configuration. (path and domain information)
- If the use exists in both XMailServer, and Zarafa, you should now be able to recieve email
#!/usr/bin/php
<?php
$strDomain = "domain.tld";
$aryarySpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/var/log/mail.log", "a"));
$procZarafa = proc_open("/usr/bin/zarafa-dagent \"" . str_replace("@" . $strDomain, "", $argv[2]) . "\"", $aryarySpec, $aryvarPipe);
if (is_resource($procZarafa))
{
$strEmail_Body = file_get_contents($argv[1]);
$strEmail_Body = substr($strEmail_Body, strpos($strEmail_Body, ">>") + 2);
$strEmail_Body = "MAIL FROM: <" . $argv[4] . ">\r\n" .
"RCPT TO: <" . $argv[3] . ">" .
$strEmail_Body;
fwrite($aryvarPipe[0], $strEmail_Body);
fclose($aryvarPipe[0]);
echo (stream_get_contents($aryvarPipe[1]));
}
echo "Return: " . proc_close($procZarafa) . "\r\n";
exit(20); // Dont deliver the message to the XMail inbox.
?>
Contributed by Sven Hagemann sven [at] rednose [dot] nl