Kaydet (Commit) 8269d576 authored tarafından Julien Nabet's avatar Julien Nabet

Fix type SMPT->SMTP

Change-Id: I09dfd8c2385e6257248b6a43ee4e2ce97ee6bdfc
üst 2ba80e59
...@@ -61,23 +61,23 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -61,23 +61,23 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self.connectioncontext = None self.connectioncontext = None
self.notify = EventObject() self.notify = EventObject()
if dbg: if dbg:
print("PyMailSMPTService init", file=dbgout) print("PyMailSMTPService init", file=dbgout)
def addConnectionListener(self, xListener): def addConnectionListener(self, xListener):
if dbg: if dbg:
print("PyMailSMPTService addConnectionListener", file=dbgout) print("PyMailSMTPService addConnectionListener", file=dbgout)
self.listeners.append(xListener) self.listeners.append(xListener)
def removeConnectionListener(self, xListener): def removeConnectionListener(self, xListener):
if dbg: if dbg:
print("PyMailSMPTService removeConnectionListener", file=dbgout) print("PyMailSMTPService removeConnectionListener", file=dbgout)
self.listeners.remove(xListener) self.listeners.remove(xListener)
def getSupportedConnectionTypes(self): def getSupportedConnectionTypes(self):
if dbg: if dbg:
print("PyMailSMPTService getSupportedConnectionTypes", file=dbgout) print("PyMailSMTPService getSupportedConnectionTypes", file=dbgout)
return self.supportedtypes return self.supportedtypes
def connect(self, xConnectionContext, xAuthenticator): def connect(self, xConnectionContext, xAuthenticator):
self.connectioncontext = xConnectionContext self.connectioncontext = xConnectionContext
if dbg: if dbg:
print("PyMailSMPTService connect", file=dbgout) print("PyMailSMTPService connect", file=dbgout)
server = xConnectionContext.getValueByName("ServerName") server = xConnectionContext.getValueByName("ServerName")
if dbg: if dbg:
print(server, file=dbgout) print(server, file=dbgout)
...@@ -110,7 +110,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -110,7 +110,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
listener.connected(self.notify) listener.connected(self.notify)
def disconnect(self): def disconnect(self):
if dbg: if dbg:
print("PyMailSMPTService disconnect", file=dbgout) print("PyMailSMTPService disconnect", file=dbgout)
if self.server: if self.server:
self.server.quit() self.server.quit()
self.server = None self.server = None
...@@ -118,17 +118,17 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -118,17 +118,17 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
listener.disconnected(self.notify) listener.disconnected(self.notify)
def isConnected(self): def isConnected(self):
if dbg: if dbg:
print("PyMailSMPTService isConnected", file=dbgout) print("PyMailSMTPService isConnected", file=dbgout)
return self.server != None return self.server != None
def getCurrentConnectionContext(self): def getCurrentConnectionContext(self):
if dbg: if dbg:
print("PyMailSMPTService getCurrentConnectionContext", file=dbgout) print("PyMailSMTPService getCurrentConnectionContext", file=dbgout)
return self.connectioncontext return self.connectioncontext
def sendMailMessage(self, xMailMessage): def sendMailMessage(self, xMailMessage):
COMMASPACE = ', ' COMMASPACE = ', '
if dbg: if dbg:
print("PyMailSMPTService sendMailMessage", file=dbgout) print("PyMailSMTPService sendMailMessage", file=dbgout)
recipients = xMailMessage.getRecipients() recipients = xMailMessage.getRecipients()
sendermail = xMailMessage.SenderAddress sendermail = xMailMessage.SenderAddress
sendername = xMailMessage.SenderName sendername = xMailMessage.SenderName
...@@ -136,10 +136,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -136,10 +136,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
ccrecipients = xMailMessage.getCcRecipients() ccrecipients = xMailMessage.getCcRecipients()
bccrecipients = xMailMessage.getBccRecipients() bccrecipients = xMailMessage.getBccRecipients()
if dbg: if dbg:
print("PyMailSMPTService subject " + subject, file=dbgout) print("PyMailSMTPService subject " + subject, file=dbgout)
print("PyMailSMPTService from " + sendername.encode('utf-8'), file=dbgout) print("PyMailSMTPService from " + sendername.encode('utf-8'), file=dbgout)
print("PyMailSMTPService from " + sendermail, file=dbgout) print("PyMailSMTPService from " + sendermail, file=dbgout)
print("PyMailSMPTService send to " + recipients, file=dbgout) print("PyMailSMTPService send to " + recipients, file=dbgout)
attachments = xMailMessage.getAttachments() attachments = xMailMessage.getAttachments()
...@@ -148,13 +148,13 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -148,13 +148,13 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
content = xMailMessage.Body content = xMailMessage.Body
flavors = content.getTransferDataFlavors() flavors = content.getTransferDataFlavors()
if dbg: if dbg:
print("PyMailSMPTService flavors len " + len(flavors), file=dbgout) print("PyMailSMTPService flavors len " + len(flavors), file=dbgout)
#Use first flavor that's sane for an email body #Use first flavor that's sane for an email body
for flavor in flavors: for flavor in flavors:
if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1: if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1:
if dbg: if dbg:
print("PyMailSMPTService mimetype is " + flavor.MimeType, file=dbgout) print("PyMailSMTPService mimetype is " + flavor.MimeType, file=dbgout)
textbody = content.getTransferData(flavor) textbody = content.getTransferData(flavor)
try: try:
textbody = textbody.value textbody = textbody.value
...@@ -232,7 +232,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -232,7 +232,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
truerecipients = uniquer.keys() truerecipients = uniquer.keys()
if dbg: if dbg:
print("PyMailSMPTService recipients are " + truerecipients, file=dbgout) print("PyMailSMTPService recipients are " + truerecipients, file=dbgout)
self.server.sendmail(sendermail, truerecipients, msg.as_string()) self.server.sendmail(sendermail, truerecipients, msg.as_string())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment