Wrong receiver address displayed


I have a kopano setup using ldap as the user backend.
I have many users that have kopanoAlias adresses set in ldap (for example: user1@dmn.de has alias test@dmn.de)

If the user receives a mail on the test@dmn.de address, the receiver address is displayed as user1@dmn.de.
If I look at the header of the message, the To: field is correct (test@dmn.de).

Any suggestions?

Hi @h44z ,

yes it shows the original to in the header, since this is stored as received from the mta.

But that you don’t see the alias in the WebApp has a reason as well. When a message is delivered by the dagent it will try to resolve all participants against the gab (and replace the individual recipient with a reference against the gab). This is done so that our clients can more easily look up free/busy and presence data.

The simple workaround if you don’t want to have the user resolved against the gab, is to remove aliases from the gab.


thanks for the reply. But I cant remove the kopanoAlias from the user, because the user also sends mails using the alias address. If I remove the alias, the user gets an error message that he is not allowed to send from the alias address.
It would be nice to have a setting to either display the user from the gab or the original To header field.

A short update:

I have written a simple plugin for Kopano Webapp that allows the user to see the “original” receiver address.

If the TO: header differs from the displayed receiver, the plugin will add a extra line to the email information.
For Example:

Gesendet: Montag 3 April 2017 00:20
An: Max Muster <max.m@test.de>
Original To: maxi.muster@gmail.com

The plugin can be found here: https://git.sprinternet.at/zarafa_webapp/origrcv

Even if I found a workaround using this plugin, a configurable option for Kopano Webapp would be a nice to have. @fbartels Where can I create a feature/bug request?

This is a problem for me too. For the moment I’ve included @h44z 's plugin to my installation as well but an option in dagent or webapp to disable this behaviour would be very much appreciated by me.


a Webapp plugin does not solve the problem. Emails synced via z-push still have wrong email, same goes for IMAP sync. Further the “sed -i” of kopano-dagent also works on attached emails (sic!). See picture

0_1491837611821_Screenshot at 2017-04-10 17-47-59.png

See post https://forums.zarafa.com/showthread.php?13528-Zarafa-Kopano-replace-alias-emails-with-email-of-user&p=58359&viewfull=1#post58359 for full problem explanation.
Last but not least, to prove that it is a bug and not a feature, I have use of GAB disabled where possible (e.g. server.cfg: enable_gab = no). I use ldap plugin.

A kopano-dagent setting to disable this behaviour would be greatly appreciated.


Yeah, I just noticed that the problem still appears on mobile/zpush. I’m probably just going to patch this out of dagent myself, and put it behind a config option. I can submit a patch/pull request to the kopano source tree if you guys take code?

@hpvb said in Wrong receiver address displayed:

I can submit a patch/pull request to the kopano source tree if you guys take code?

Sure, patches are welcome! You can find the contributing information at https://stash.kopano.io/projects/KC/repos/kopanocore/browse/CONTRIBUTING.md and as long as you make this behavior optional and non-default I don’t see a problem with it.

OK, I’m working on a patch but it’s a little harder than I thought. It seems there’s no explicit point in the code where this happens. I was looking in ResolveUsers() but I don’t think that’s it.

I actually ended up writing a DAgent plugin for this. This was way easier and a little easier for me to manage with regards to upgrades. It’d be nice if there were srpms for the open source packages :)

This does only partially fix the problem though: From headers are still rewritten which is very confusing too :)

Maybe this shows what my/our problem is though. I don’t know how much work it’d be to do this in DAgent directly.

import MAPI
import email
from email.utils import getaddresses

from MAPI.Util import *
from plugintemplates import *

class RewriteUsers(IMapiDAgentPlugin):

    def __init__(self, logger):
        IMapiDAgentPlugin.__init__(self, logger)

    def PreDelivery(self, session, addrbook, store, folder, message):
        headers = message.GetProps([PR_TRANSPORT_MESSAGE_HEADERS], 0)[0].Value
        msg = email.message_from_string(headers)
        to_addrs = getaddresses(msg.get_all('to', []))
        cc_addrs = getaddresses(msg.get_all('cc', []))

        names = []
        for addr in to_addrs:
                SPropValue(PR_RECIPIENT_TYPE, MAPI_TO),
                SPropValue(PR_DISPLAY_NAME_W, unicode(addr[0])),
                SPropValue(PR_ADDRTYPE, 'SMTP'),
                SPropValue(PR_EMAIL_ADDRESS, unicode(addr[1])),

        for addr in cc_addrs:
                SPropValue(PR_RECIPIENT_TYPE, MAPI_CC),
                SPropValue(PR_DISPLAY_NAME_W, unicode(addr[0])),
                SPropValue(PR_ADDRTYPE, 'SMTP'),
                SPropValue(PR_EMAIL_ADDRESS, unicode(addr[1])),

        message.ModifyRecipients(0, names)
        return MP_CONTINUE,

@hpvb thanks for posting the plugin. If you add some documentation and add upload it somewhere (be for example in a gist at Github), then you could also add it to https://stash.z-hub.io/projects/COM/repos/projects-and-resources/browse#Kopano-dAgent-Spooler-Plugins

@fbartels sure, I’ll setup a repository for it and add some documentation. This may be useful for others besides just me and the other two people in this thread.

@hpvb great. if you need any assistance let me know. If you don’t want to create a Github/Whatever account, then you could also create a personal git repo on stash.z-hub.io.

@fbartels Does this look OK to you?

If so I’ll add it to that wiki page.

@hpvb did not test your script, but the description reads fine for me. Thanks for making a repository for it.

I’ve sent a PR for that repository. Thanks for your feedback.

@hpvb thanks a lot. Can’t wait for your patch to reach nightly builds.

@Pozzo-Balbi I didn’t end up writing a patch for dagent, but a plugin for dagent. You can get it here : https://notabug.org/hp/kopano-dagent-rewritegaladdresses. Once that is installed everything should start working. I’ve had it running for 5 days now without issue.

Log in to reply

Looks like your connection to Kopano Community Forum was lost, please wait while we try to reconnect.