diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-12-06 09:57:39 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-12-06 09:57:39 +0000 |
commit | 28499d947c5a209dbd466fc314a27f5b8ec623b4 (patch) | |
tree | 89f9606d72bbc7fd791f3b88eba983cc3f22a79c /scripting/source/pyprov | |
parent | e03b635c9f3fe9e7023119491e6a5f4857d013d4 (diff) |
INTEGRATION: CWS os108 (1.7.26); FILE MERGED
2007/11/29 06:43:28 os 1.7.26.2: #i77449# missing import added
2007/11/15 12:07:23 os 1.7.26.1: #i77449# SenderName added to mail merge e-Mail
Diffstat (limited to 'scripting/source/pyprov')
-rw-r--r-- | scripting/source/pyprov/mailmerge.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 6fe192c285c5..55994702df35 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -36,6 +36,7 @@ from com.sun.star.mail import SendMailMessageFailedException from email.MIMEBase import MIMEBase from email.Message import Message from email import Encoders +from email.Header import Header from email.MIMEMultipart import MIMEMultipart from email.Utils import formatdate @@ -115,13 +116,15 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): if dbg: print >> sys.stderr, "PyMailSMPTService sendMailMessage" recipients = xMailMessage.getRecipients() - sender = xMailMessage.SenderAddress + sendermail = xMailMessage.SenderAddress + sendername = xMailMessage.SenderName subject = xMailMessage.Subject ccrecipients = xMailMessage.getCcRecipients() bccrecipients = xMailMessage.getBccRecipients() if dbg: print >> sys.stderr, "PyMailSMPTService subject", subject - print >> sys.stderr, "PyMailSMPTService from", sender + print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8') + print >> sys.stderr, "PyMailSMTPService from", sendermail print >> sys.stderr, "PyMailSMPTService send to", recipients attachments = xMailMessage.getAttachments() @@ -146,8 +149,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): else: msg = textmsg - msg['Subject'] = subject - msg['From'] = sender + hdr = Header(sendername, 'utf-8') + hdr.append('<'+sendermail+'>','us-ascii') + msg['Subject'] = subject + msg['From'] = hdr msg['To'] = COMMASPACE.join(recipients) if len(ccrecipients): msg['Cc'] = COMMASPACE.join(ccrecipients) @@ -185,7 +190,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): if dbg: print >> sys.stderr, "PyMailSMPTService recipients are", truerecipients - self.server.sendmail(sender, truerecipients, msg.as_string()) + self.server.sendmail(sendermail, truerecipients, msg.as_string()) class PyMailIMAPService(unohelper.Base, XMailService): def __init__( self, ctx ): |