summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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')