Page tree
Skip to end of metadata
Go to start of metadata

This tutorial works for UCS 4.1 and Kopano 8.1 only. After update to UCS 4.2 and Kopano 8.2 mail transport doesn't work, unfortunately.

@fbartels: I was asked by Univention to clarify that modifying univention-config-registry templates is generally not a good idea and can lead to problems during package upgrades. A different approach to this can be found at https://help.univention.com/t/postfix-kopano-versendet-nicht-mehr-nach-update-auf-4-2-1-errata52/5997/10 & https://help.univention.com/t/absenderabhangiger-smarthost-554-fehler/3875

Preliminary remark

This tutorial is the result of a setup project of Kopano on Univention. Informations of the Univention forum and the Zarafa/Kopano are compiled here, which otherwise had to be looked up by own search. Thanks to all those who are participating in these communities. There may be other approaches to reach the goal.

This tutorial shows the steps necessary to serve the scenario decribed below only.

Scenario

  • Kopano shall be used as mail center for a small group on Univention
  • The server has a dynamic IP-address as many small group servers have, which use a standard internet connection.
  • Emails between local users are sent using local email-addresses, they do not leave the server.
  • Every user has also one or more email-addresses with different domain names (e.g. adomain.com, bdomain.org), which are hosted by external providers.
  • Emails from these external addresses shall be collected in the users Inbox and afterwards deleted from the servers.
  • The user shall receive these emails in his Inbox with the recipient address it was sent to. (Standard behaviour is to rewrite the reciepient address to the internal address of the user, thus preventing him to see to which address it was originally sent.)
  • The user shall be able to write/answer emails with all his external email-addresses.

More technically it is about sending and receiving email using multilple mailrelays to external providers and multiple accounts in fetchmail for every user, without rewriting the recipient address in Kopano.

Prerequisites

  • Fetchmail, Kopano Core and Kopano Webapp has to be installed
  • The users must exist, otherwise emails will not be delivered. When creating an user account, it is enough to assign only an internal email address. The rest will be done later.
  • Some experience and basic knowledge of Linux command line, Fetchmail, Postfix and UCR (Univention Configuration Registry)

Setup

Configuration of fetchmail for collecting external emails

After installation of fetchmail the user administration provides the possibility to assign one external email account per user to collect emails from, see 'User:name|Advanced settings|Remote mail retrieval' (German: 'Benutzer:Name|Erweiterte Einstellungen|Mailabruf von externen Servern')

If you want to add more than one email account you have to edit the file /etc/fetchmailrc on the command line. Just look at the file after adding an external account in the user administration. Copy the line starting with 'poll' and adjust server, email address, password according to your needs.

IMPORTANT: Finally remove the #UID='username' at the end of the copied line. Otherwise your added line will interfere with Univentions automatical updates.

(Source: http://forum.univention.de/viewtopic.php?f=28&t=5719&p=24099#p24099)

Reduction of polling interval

Since fetchmailrc isn't updated completely by Univention you can reduce the polling interval by hand. It is set to 20 minutes by default (set daemon 1200). Changing 1200 to 300 reduces the polling time to 5 Minutes.

(Source: http://forum.univention.de/viewtopic.php?f=28&t=5647)

Kopano now receives all emails from the accounts set in fetchmailrc.

Configuration of postfix for sending emails via relayhosts

MyKey0815 has described how to do it in http://forum.univention.de/viewtopic.php?f=28&t=4725. This post is in German unfortunately. Most important is not to set the mail/relayhost variable in the Univention Configuration Registry (UCR), otherwise you can only use this single relayhost. If you want to use more than one relayhost follow the topic linked above. You will have to create or add to

Take your time in editing, creating these files. Any error here will prevent postfix from sending emails via relayhosts!

Don't forget to "postmap" the last 3 files.

Let rewrite postfix' main.cf on the command line: 'ucr commit /etc/postfix/main.cf'

Reload the postfix configuration on the command line: 'postfix reload'.

Now Postfix can send mails via external providers. But Kopano cannot yet. So go on.

Solution to keep the original recipient address

Kopano uses only the primaryEmailAddress from the Univention user account to deliver emails. That means all alternative email addresses you add in 'User:name|Advanced settings|Mail' (German: 'Benutzer:Name|Erweiterte Einstellungen|E-Mail') will be rewritten to the primary email address. As result you won't see which address the sender originally used, which normally is not what you want. There is only a workaround to overcome this situation:

Register Email Domains

First all external email domains (not the whole addresses) have to be registered in Univention 'Domain|Mail' as Mail domains. Now Univention thinks all these domains are local and want to take care of it. This is not what we want, but we need it for later.

Create Transport Maps

To instruct Univention that the external email domains we registered above, should be taken care by external providers we have to create transport maps. In the command line do for every email domain:

'ucr set mail/maps/transport/adomainmails="adomain.com smtp:[smtp.provider.com]"'

For 'adomainmails' you can choose what suits you as long you only use letters and numbers.

Initialize the new settings from the command line with:

invoke-rc.d univention-management-console-server restart
postfix reload

Now the emails are sent properly over external providers again.

Create Groups for external email addresses

This is the part, where we omit the rewriting of the recipient addresses. For that we needed to register the email domains above, because now Univention allows us to create users or groups with email addresses of the external domains.

For every email address create a group in Univention:

  • General:
    • Choose a group name your recipients will understand, because it will be sent with every email.
    • Add your user as the single group member.
  • Kopano:
    • Make it a Kopano group.

    • Add your user as delegate, that she/he can send emails for this group.

  • Advanced settings|Mail:
    • Add the external email address.

In Kopano Webapp add this group as 'Send as'

(Source: https://forums.zarafa.com/showthread.php?8420-multiple-domains-vs-primary-email)

In Kopano Webapp you will see to which address the incoming emails were sent and you can send emails with adresses from external domains.

 

  • No labels