XMailServer as MTA

From Zarafa wiki

Jump to: navigation, search

Using XMailServer as the Zarafa MTA

Using XMailServer in combination with Zarafa is a good solution for several reasons.

  1. XMail runs on every POSIX platform, it doesn't have many dependencies.
  2. It is lightweight, powerful, and fast.
  3. It has its own userbase
  4. There are many opensoure tools to manage the userbase.
  5. 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


- open the file /var/MailRoot/filters.in.tab and put the following line in its body


- 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

 $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] . ">" .
   fwrite($aryvarPipe[0], $strEmail_Body);

   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

Personal tools