diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-02-08 21:03:44 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-02-08 21:03:44 +0100 |
commit | d80a04b456bdfafa64822fe5f310ff0dc332de6e (patch) | |
tree | 6bf8a95beddf8cb432266aa870857ed96a6f5d63 | |
parent | 03254dd34f7da4780c4fe356a1af2f956398df11 (diff) | |
download | pykolab-d80a04b456bdfafa64822fe5f310ff0dc332de6e.tar.gz |
Sending out the message requires nul characters (where do they come from?) be stripped
-rw-r--r-- | wallace/modules.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/wallace/modules.py b/wallace/modules.py index a20d80e..040fe62 100644 --- a/wallace/modules.py +++ b/wallace/modules.py @@ -252,8 +252,8 @@ X-Wallace-Result: REJECT def cb_action_ACCEPT(module, filepath): log.info(_("Accepting message in %s (by module %s)") % (filepath, module)) _message = json.load(open(filepath, 'r')) + message = message_from_string(_message['data']) - message = message_from_string("%s" %(str(_message['data']))) sender = _message['from'] recipients = _message['to'] @@ -266,7 +266,13 @@ def cb_action_ACCEPT(module, filepath): smtp.sendmail( sender, recipients, - message.as_string() + # - Make sure we do not send this as binary. + # - Second, strip NUL characters - I don't know where they + # come from (TODO) + # - Third, a character return is inserted somewhere. It + # divides the body from the headers - and we don't like (TODO) + #unicode(message.as_string()).replace('\0', '').lstrip() + message.as_string().encode('utf-8').replace('\0','').lstrip() ) except smtplib.SMTPDataError, errmsg: |