I am using mainly Polish language so it is obvious that fairly quickly I encountered a problem with national characters in the subject line. Problem is not fixed in Debian packages (using Debian Wheezy x86_64 and Kolab Systems – Public Repositories) but luckily it is very easy to fix.
Problem description
Problem applies to the wallace daemon. Some messages containing national characters in the subject line are stuck in the mail queue.
It is precisely described at Bug 1627 – Some mail with national characters in subject is rejected by kolab page.
Solution
Patch against current wallace version by Enrico Tagliavini is available at the above mentioned link.
I just quickly adapted it for the Debian package wallace 0.5.11-5 version:
--- wallace.orig/__init__.py 2013-04-18 17:03:57.000000000 +0000
+++ wallace/__init__.py 2013-05-28 09:41:23.000000000 +0000
@@ -246,7 +246,7 @@
{
'from': mailfrom,
'to': rcpttos,
- 'data': data
+ 'data': data.encode('string-escape')
}
)
--- wallace.orig/modules.py 2013-05-28 09:46:45.000000000 +0000
+++ wallace/modules.py 2013-05-28 11:22:54.000000000 +0000
@@ -120,7 +120,7 @@
def cb_action_DEFER(module, filepath):
log.info(_("Deferring message in %s (by module %s)") % (filepath, module))
- message = json.load(open(filepath, 'r'))
+ message = load_and_decode_from_file(filepath)
message = message_from_string(message['data'])
internal_time = parsedate_tz(message.__getitem__('Date'))
@@ -163,7 +163,7 @@
def cb_action_REJECT(module, filepath):
log.info(_("Rejecting message in %s (by module %s)") % (filepath, module))
- _message = json.load(open(filepath, 'r'))
+ _message = load_and_decode_from_file(filepath)
message = message_from_string(_message['data'])
envelope_sender = getaddresses(message.get_all('From', []))
@@ -251,7 +251,7 @@
def cb_action_ACCEPT(module, filepath):
log.info(_("Accepting message in %s (by module %s)") % (filepath, module))
- _message = json.load(open(filepath, 'r'))
+ _message = load_and_decode_from_file(filepath)
message = message_from_string("%s" %(str(_message['data'])))
sender = _message['from']
@@ -285,6 +285,9 @@
log.error("SMTP Sender Refused, %r" % (errmsg))
# DEFER
pass
+ except Exception as e:
+ log.error(str(e))
+ pass
finally:
os.unlink(filepath)
@@ -348,3 +351,9 @@
'description': _("Alias for %s") % (name)
}
+def load_and_decode_from_file(filepath):
+ f = open(filepath, 'r')
+ message = json.load(f)
+ message['data'] = message['data'].decode('string_escape')
+ f.close()
+ return message
Download wallace patch:
# wget -q -O - https://sleeplessbeastie.eu/wp-content/uploads/2013/05/wallace.gz | gzip -d - > ~/wallace.patch
Verify MD5 checksum:
# md5sum ~/wallace.patch
075d7408a4a974e25bfa767bfed83d7c /root/wallace.patch
Change directory and verify file checksums:
# cd /usr/share/pyshared/wallace
# md5sum *
2431cbd3c29560f01bb92a4f7b1a9b41 __init__.py
d9f3ef249e289723697d97031aadaac7 module_optout.py
e7489a29926d82dcc9205759cd279ee0 module_resources.py
f20a288e7676eca20315035a761f1029 modules.py
Apply path:
# patch -p1 < ~/wallace.patch
patching file __init__.py
patching file modules.py
Restart wallace service and flush postfix queue:
# service wallace restart
# postfix flush