Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    Wrong receiver address displayed

    Kopano WebApp
    5
    19
    4959
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • h44z
      h44z last edited by

      Hi,

      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?

      fbartels 1 Reply Last reply Reply Quote 0
      • fbartels
        fbartels Kopano @h44z last edited by

        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.

        Regards Felix

        Resources:
        https://kopano.com/blog/how-to-get-kopano/
        https://documentation.kopano.io/
        https://kb.kopano.io/

        Support overview:
        https://kopano.com/support/

        1 Reply Last reply Reply Quote 0
        • h44z
          h44z last edited by

          Hi,

          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.

          1 Reply Last reply Reply Quote 0
          • h44z
            h44z last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • hpvb
              hpvb last edited by

              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.

              hpvb 1 Reply Last reply Reply Quote 0
              • Pozzo-Balbi
                Pozzo-Balbi last edited by

                Hi,

                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.

                Thanks

                1 Reply Last reply Reply Quote 0
                • hpvb
                  hpvb @hpvb last edited by

                  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?

                  fbartels 1 Reply Last reply Reply Quote 0
                  • fbartels
                    fbartels Kopano @hpvb last edited by

                    @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.

                    Regards Felix

                    Resources:
                    https://kopano.com/blog/how-to-get-kopano/
                    https://documentation.kopano.io/
                    https://kb.kopano.io/

                    Support overview:
                    https://kopano.com/support/

                    1 Reply Last reply Reply Quote 0
                    • hpvb
                      hpvb last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • hpvb
                        hpvb last edited by hpvb

                        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:
                                    names.append([
                                        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:
                                    names.append([
                                        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,
                        
                        fbartels 1 Reply Last reply Reply Quote 0
                        • fbartels
                          fbartels Kopano @hpvb last edited by

                          @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

                          Regards Felix

                          Resources:
                          https://kopano.com/blog/how-to-get-kopano/
                          https://documentation.kopano.io/
                          https://kb.kopano.io/

                          Support overview:
                          https://kopano.com/support/

                          1 Reply Last reply Reply Quote 0
                          • hpvb
                            hpvb last edited by

                            @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.

                            fbartels 1 Reply Last reply Reply Quote 0
                            • fbartels
                              fbartels Kopano @hpvb last edited by

                              @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.

                              Regards Felix

                              Resources:
                              https://kopano.com/blog/how-to-get-kopano/
                              https://documentation.kopano.io/
                              https://kb.kopano.io/

                              Support overview:
                              https://kopano.com/support/

                              1 Reply Last reply Reply Quote 0
                              • hpvb
                                hpvb last edited by hpvb

                                @fbartels Does this look OK to you?
                                https://notabug.org/hp/kopano-dagent-rewritegaladdresses

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

                                fbartels 1 Reply Last reply Reply Quote 0
                                • fbartels
                                  fbartels Kopano @hpvb last edited by

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

                                  Regards Felix

                                  Resources:
                                  https://kopano.com/blog/how-to-get-kopano/
                                  https://documentation.kopano.io/
                                  https://kb.kopano.io/

                                  Support overview:
                                  https://kopano.com/support/

                                  1 Reply Last reply Reply Quote 0
                                  • hpvb
                                    hpvb last edited by

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

                                    1 Reply Last reply Reply Quote 1
                                    • Pozzo-Balbi
                                      Pozzo-Balbi last edited by

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

                                      1 Reply Last reply Reply Quote 0
                                      • hpvb
                                        hpvb last edited by

                                        @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.

                                        1 Reply Last reply Reply Quote 0
                                        • mnewman
                                          mnewman last edited by

                                          Can someone please fix the Plugin. It´s not working with Python 3 in Kopano 8.7

                                          Thanks
                                          Markus

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post