Wrong receiver address displayed
-
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: 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,
-
@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?
https://notabug.org/hp/kopano-dagent-rewritegaladdressesIf 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.
-
Can someone please fix the Plugin. It´s not working with Python 3 in Kopano 8.7
Thanks
Markus