summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2007-04-26 07:06:44 +0000
committerRüdiger Timm <rt@openoffice.org>2007-04-26 07:06:44 +0000
commit00712aa434eadaf46fb2fefec1288ee92b8489b8 (patch)
treee0a851ee70f46881f0e318d723753435dbeb7625 /scripting
parent6a358f90dbb3849e0c79b7f5255e2bfacc923e90 (diff)
INTEGRATION: CWS cmcfixes33 (1.6.8); FILE MERGED
2007/03/13 11:45:20 cmc 1.6.8.1: #i74789# better mimetype and add a proper timestamp
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/pyprov/mailmerge.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 586297619c70..6fe192c285c5 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -15,6 +15,7 @@
import unohelper
import uno
+import re
#to implement com::sun::star::mail::XMailServiceProvider
@@ -36,6 +37,7 @@ from email.MIMEBase import MIMEBase
from email.Message import Message
from email import Encoders
from email.MIMEMultipart import MIMEMultipart
+from email.Utils import formatdate
import sys, smtplib, imaplib, poplib
@@ -132,7 +134,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
textbody = content.getTransferData(flavor)
textmsg = Message()
- textmsg['Content-Type'] = flavor.MimeType
+ mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType)
+ textmsg['Content-Type'] = mimeEncoding
textmsg['MIME-Version'] = '1.0'
textmsg.set_payload(textbody.encode('utf-8'))
@@ -152,6 +155,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
msg['Reply-To'] = xMailMessage.ReplyToAddress
msg['X-Mailer'] = "OpenOffice.org 2.0 via Caolan's mailmerge component"
+ msg['Date'] = formatdate(localtime=True)
+
for attachment in attachments:
content = attachment.Data
flavors = content.getTransferDataFlavors()