summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-13 15:56:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-13 15:59:35 +0100
commitc4aa13c931da11164835a7aafbfd7e44bd5714ca (patch)
treef2e0f6eaedec6d91ad35d85da6d165e37a9be706
parentdf4f9dedaa4c4cba0d78bfb935a58b98faa4f553 (diff)
Resolves: fdo#66761 Macro controlled Python Mailmerge broken
Change-Id: Id8bbf06a5571534aa5eef8624e89565fe3715938
-rwxr-xr-xscripting/source/pyprov/mailmerge.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index cbd1428c5b9f..6fa486daf0a9 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -182,7 +182,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
textmsg['Content-Type'] = mimeEncoding
textmsg['MIME-Version'] = '1.0'
- textbody = textbody.encode('utf-8')
+ try:
+ textbody = textbody.encode('utf-8')
+ except:
+ textbody = str(textbody.value).encode('utf-8')
if sys.version >= '3':
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
textbody = textbody.decode('iso8859-1')