diff options
author | Caolán McNamara <cmc@openoffice.org> | 2010-02-04 11:13:49 +0000 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2010-02-04 11:13:49 +0000 |
commit | 07e314f63e3f1f3649e8ba91f36758519d585183 (patch) | |
tree | 939153cf01a917cba9bc8a830a3a3165303b4168 /scripting/source/pyprov/mailmerge.py | |
parent | 973b606deabaa3631aec5317037035ed4505db47 (diff) |
cmcfixes71: #i108945# fix From field in mailmerge
Diffstat (limited to 'scripting/source/pyprov/mailmerge.py')
-rw-r--r-- | scripting/source/pyprov/mailmerge.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index c8f7b6765261..f9c2f0f70b09 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -37,6 +37,7 @@ from email import Encoders from email.Header import Header from email.MIMEMultipart import MIMEMultipart from email.Utils import formatdate +from email.Utils import formataddr import sys, smtplib, imaplib, poplib @@ -123,8 +124,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): bccrecipients = xMailMessage.getBccRecipients() if dbg: print >> sys.stderr, "PyMailSMPTService subject", subject - print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8') - print >> sys.stderr, "PyMailSMTPService from", sendermail + print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8'), sendermail + print >> sys.stderr, "PyMailSMTPService from", formataddr((sendername.encode('utf-8'), sendermail)) print >> sys.stderr, "PyMailSMPTService send to", recipients attachments = xMailMessage.getAttachments() @@ -149,10 +150,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): else: msg = textmsg - hdr = Header(sendername, 'utf-8') - hdr.append('<'+sendermail+'>','us-ascii') msg['Subject'] = subject - msg['From'] = hdr + msg['From'] = formataddr((sendername.encode('utf-8'), sendermail)) msg['To'] = COMMASPACE.join(recipients) if len(ccrecipients): msg['Cc'] = COMMASPACE.join(ccrecipients) |