Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
a1775d69
Kaydet (Commit)
a1775d69
authored
Agu 02, 2011
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
make logging less painful under windows
üst
a34c9a80
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
61 deletions
+68
-61
mailmerge.py
scripting/source/pyprov/mailmerge.py
+68
-61
No files found.
scripting/source/pyprov/mailmerge.py
Dosyayı görüntüle @
a1775d69
...
@@ -45,6 +45,13 @@ from email.Utils import parseaddr
...
@@ -45,6 +45,13 @@ from email.Utils import parseaddr
import
sys
,
smtplib
,
imaplib
,
poplib
import
sys
,
smtplib
,
imaplib
,
poplib
dbg
=
False
dbg
=
False
#no stderr under windows, output to pymailmerge.log
#with no buffering
if
dbg
and
os
.
name
==
'nt'
:
dbgout
=
open
(
'pymailmerge.log'
,
'w'
,
0
)
else
dbgout
=
sys
.
stderr
class
PyMailSMTPService
(
unohelper
.
Base
,
XSmtpService
):
class
PyMailSMTPService
(
unohelper
.
Base
,
XSmtpService
):
def
__init__
(
self
,
ctx
):
def
__init__
(
self
,
ctx
):
self
.
ctx
=
ctx
self
.
ctx
=
ctx
...
@@ -54,29 +61,29 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -54,29 +61,29 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self
.
connectioncontext
=
None
self
.
connectioncontext
=
None
self
.
notify
=
EventObject
()
self
.
notify
=
EventObject
()
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService init"
print
>>
dbgout
,
"PyMailSMPTService init"
def
addConnectionListener
(
self
,
xListener
):
def
addConnectionListener
(
self
,
xListener
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService addConnectionListener"
print
>>
dbgout
,
"PyMailSMPTService addConnectionListener"
self
.
listeners
.
append
(
xListener
)
self
.
listeners
.
append
(
xListener
)
def
removeConnectionListener
(
self
,
xListener
):
def
removeConnectionListener
(
self
,
xListener
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService removeConnectionListener"
print
>>
dbgout
,
"PyMailSMPTService removeConnectionListener"
self
.
listeners
.
remove
(
xListener
)
self
.
listeners
.
remove
(
xListener
)
def
getSupportedConnectionTypes
(
self
):
def
getSupportedConnectionTypes
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService getSupportedConnectionTypes"
print
>>
dbgout
,
"PyMailSMPTService getSupportedConnectionTypes"
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
>>
sys
.
stderr
,
"PyMailSMPTService connect"
print
>>
dbgout
,
"PyMailSMPTService connect"
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
server
print
>>
dbgout
,
server
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
port
print
>>
dbgout
,
port
self
.
server
=
smtplib
.
SMTP
(
server
,
port
)
self
.
server
=
smtplib
.
SMTP
(
server
,
port
)
#stderr not available for us under windows, but
#stderr not available for us under windows, but
#set_debuglevel outputs there, and so throw
#set_debuglevel outputs there, and so throw
...
@@ -86,7 +93,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -86,7 +93,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self
.
server
.
set_debuglevel
(
1
)
self
.
server
.
set_debuglevel
(
1
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
connectiontype
print
>>
dbgout
,
connectiontype
if
connectiontype
==
'Ssl'
:
if
connectiontype
==
'Ssl'
:
self
.
server
.
ehlo
()
self
.
server
.
ehlo
()
self
.
server
.
starttls
()
self
.
server
.
starttls
()
...
@@ -96,14 +103,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -96,14 +103,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
user
!=
''
:
if
user
!=
''
:
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
'Logging in, username of'
,
user
print
>>
dbgout
,
'Logging in, username of'
,
user
self
.
server
.
login
(
user
,
password
)
self
.
server
.
login
(
user
,
password
)
for
listener
in
self
.
listeners
:
for
listener
in
self
.
listeners
:
listener
.
connected
(
self
.
notify
)
listener
.
connected
(
self
.
notify
)
def
disconnect
(
self
):
def
disconnect
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService disconnect"
print
>>
dbgout
,
"PyMailSMPTService disconnect"
if
self
.
server
:
if
self
.
server
:
self
.
server
.
quit
()
self
.
server
.
quit
()
self
.
server
=
None
self
.
server
=
None
...
@@ -111,17 +118,17 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -111,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
>>
sys
.
stderr
,
"PyMailSMPTService isConnected"
print
>>
dbgout
,
"PyMailSMPTService isConnected"
return
self
.
server
!=
None
return
self
.
server
!=
None
def
getCurrentConnectionContext
(
self
):
def
getCurrentConnectionContext
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService getCurrentConnectionContext"
print
>>
dbgout
,
"PyMailSMPTService getCurrentConnectionContext"
return
self
.
connectioncontext
return
self
.
connectioncontext
def
sendMailMessage
(
self
,
xMailMessage
):
def
sendMailMessage
(
self
,
xMailMessage
):
COMMASPACE
=
', '
COMMASPACE
=
', '
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService sendMailMessage"
print
>>
dbgout
,
"PyMailSMPTService sendMailMessage"
recipients
=
xMailMessage
.
getRecipients
()
recipients
=
xMailMessage
.
getRecipients
()
sendermail
=
xMailMessage
.
SenderAddress
sendermail
=
xMailMessage
.
SenderAddress
sendername
=
xMailMessage
.
SenderName
sendername
=
xMailMessage
.
SenderName
...
@@ -129,10 +136,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -129,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
>>
sys
.
stderr
,
"PyMailSMPTService subject"
,
subject
print
>>
dbgout
,
"PyMailSMPTService subject"
,
subject
print
>>
sys
.
stderr
,
"PyMailSMPTService from"
,
sendername
.
encode
(
'utf-8'
)
print
>>
dbgout
,
"PyMailSMPTService from"
,
sendername
.
encode
(
'utf-8'
)
print
>>
sys
.
stderr
,
"PyMailSMTPService from"
,
sendermail
print
>>
dbgout
,
"PyMailSMTPService from"
,
sendermail
print
>>
sys
.
stderr
,
"PyMailSMPTService send to"
,
recipients
print
>>
dbgout
,
"PyMailSMPTService send to"
,
recipients
attachments
=
xMailMessage
.
getAttachments
()
attachments
=
xMailMessage
.
getAttachments
()
...
@@ -141,13 +148,13 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -141,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
>>
sys
.
stderr
,
"PyMailSMPTService flavors len"
,
len
(
flavors
)
print
>>
dbgout
,
"PyMailSMPTService flavors len"
,
len
(
flavors
)
#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
>>
sys
.
stderr
,
"PyMailSMPTService mimetype is"
,
flavor
.
MimeType
print
>>
dbgout
,
"PyMailSMPTService mimetype is"
,
flavor
.
MimeType
textbody
=
content
.
getTransferData
(
flavor
)
textbody
=
content
.
getTransferData
(
flavor
)
try
:
try
:
textbody
=
textbody
.
value
textbody
=
textbody
.
value
...
@@ -225,7 +232,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
...
@@ -225,7 +232,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
truerecipients
=
uniquer
.
keys
()
truerecipients
=
uniquer
.
keys
()
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService recipients are"
,
truerecipients
print
>>
dbgout
,
"PyMailSMPTService recipients are"
,
truerecipients
self
.
server
.
sendmail
(
sendermail
,
truerecipients
,
msg
.
as_string
())
self
.
server
.
sendmail
(
sendermail
,
truerecipients
,
msg
.
as_string
())
...
@@ -238,52 +245,52 @@ class PyMailIMAPService(unohelper.Base, XMailService):
...
@@ -238,52 +245,52 @@ class PyMailIMAPService(unohelper.Base, XMailService):
self
.
connectioncontext
=
None
self
.
connectioncontext
=
None
self
.
notify
=
EventObject
()
self
.
notify
=
EventObject
()
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService init"
print
>>
dbgout
,
"PyMailIMAPService init"
def
addConnectionListener
(
self
,
xListener
):
def
addConnectionListener
(
self
,
xListener
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService addConnectionListener"
print
>>
dbgout
,
"PyMailIMAPService addConnectionListener"
self
.
listeners
.
append
(
xListener
)
self
.
listeners
.
append
(
xListener
)
def
removeConnectionListener
(
self
,
xListener
):
def
removeConnectionListener
(
self
,
xListener
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService removeConnectionListener"
print
>>
dbgout
,
"PyMailIMAPService removeConnectionListener"
self
.
listeners
.
remove
(
xListener
)
self
.
listeners
.
remove
(
xListener
)
def
getSupportedConnectionTypes
(
self
):
def
getSupportedConnectionTypes
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService getSupportedConnectionTypes"
print
>>
dbgout
,
"PyMailIMAPService getSupportedConnectionTypes"
return
self
.
supportedtypes
return
self
.
supportedtypes
def
connect
(
self
,
xConnectionContext
,
xAuthenticator
):
def
connect
(
self
,
xConnectionContext
,
xAuthenticator
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService connect"
print
>>
dbgout
,
"PyMailIMAPService connect"
self
.
connectioncontext
=
xConnectionContext
self
.
connectioncontext
=
xConnectionContext
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
server
print
>>
dbgout
,
server
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
port
print
>>
dbgout
,
port
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
connectiontype
print
>>
dbgout
,
connectiontype
print
>>
sys
.
stderr
,
"BEFORE"
print
>>
dbgout
,
"BEFORE"
if
connectiontype
==
'Ssl'
:
if
connectiontype
==
'Ssl'
:
self
.
server
=
imaplib
.
IMAP4_SSL
(
server
,
port
)
self
.
server
=
imaplib
.
IMAP4_SSL
(
server
,
port
)
else
:
else
:
self
.
server
=
imaplib
.
IMAP4
(
server
,
port
)
self
.
server
=
imaplib
.
IMAP4
(
server
,
port
)
print
>>
sys
.
stderr
,
"AFTER"
print
>>
dbgout
,
"AFTER"
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
user
!=
''
:
if
user
!=
''
:
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
'Logging in, username of'
,
user
print
>>
dbgout
,
'Logging in, username of'
,
user
self
.
server
.
login
(
user
,
password
)
self
.
server
.
login
(
user
,
password
)
for
listener
in
self
.
listeners
:
for
listener
in
self
.
listeners
:
listener
.
connected
(
self
.
notify
)
listener
.
connected
(
self
.
notify
)
def
disconnect
(
self
):
def
disconnect
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService disconnect"
print
>>
dbgout
,
"PyMailIMAPService disconnect"
if
self
.
server
:
if
self
.
server
:
self
.
server
.
logout
()
self
.
server
.
logout
()
self
.
server
=
None
self
.
server
=
None
...
@@ -291,11 +298,11 @@ class PyMailIMAPService(unohelper.Base, XMailService):
...
@@ -291,11 +298,11 @@ class PyMailIMAPService(unohelper.Base, XMailService):
listener
.
disconnected
(
self
.
notify
)
listener
.
disconnected
(
self
.
notify
)
def
isConnected
(
self
):
def
isConnected
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService isConnected"
print
>>
dbgout
,
"PyMailIMAPService isConnected"
return
self
.
server
!=
None
return
self
.
server
!=
None
def
getCurrentConnectionContext
(
self
):
def
getCurrentConnectionContext
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService getCurrentConnectionContext"
print
>>
dbgout
,
"PyMailIMAPService getCurrentConnectionContext"
return
self
.
connectioncontext
return
self
.
connectioncontext
class
PyMailPOP3Service
(
unohelper
.
Base
,
XMailService
):
class
PyMailPOP3Service
(
unohelper
.
Base
,
XMailService
):
...
@@ -307,44 +314,44 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
...
@@ -307,44 +314,44 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
self
.
connectioncontext
=
None
self
.
connectioncontext
=
None
self
.
notify
=
EventObject
()
self
.
notify
=
EventObject
()
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service init"
print
>>
dbgout
,
"PyMailPOP3Service init"
def
addConnectionListener
(
self
,
xListener
):
def
addConnectionListener
(
self
,
xListener
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service addConnectionListener"
print
>>
dbgout
,
"PyMailPOP3Service addConnectionListener"
self
.
listeners
.
append
(
xListener
)
self
.
listeners
.
append
(
xListener
)
def
removeConnectionListener
(
self
,
xListener
):
def
removeConnectionListener
(
self
,
xListener
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service removeConnectionListener"
print
>>
dbgout
,
"PyMailPOP3Service removeConnectionListener"
self
.
listeners
.
remove
(
xListener
)
self
.
listeners
.
remove
(
xListener
)
def
getSupportedConnectionTypes
(
self
):
def
getSupportedConnectionTypes
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service getSupportedConnectionTypes"
print
>>
dbgout
,
"PyMailPOP3Service getSupportedConnectionTypes"
return
self
.
supportedtypes
return
self
.
supportedtypes
def
connect
(
self
,
xConnectionContext
,
xAuthenticator
):
def
connect
(
self
,
xConnectionContext
,
xAuthenticator
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service connect"
print
>>
dbgout
,
"PyMailPOP3Service connect"
self
.
connectioncontext
=
xConnectionContext
self
.
connectioncontext
=
xConnectionContext
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
server
print
>>
dbgout
,
server
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
port
print
>>
dbgout
,
port
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
connectiontype
print
>>
dbgout
,
connectiontype
print
>>
sys
.
stderr
,
"BEFORE"
print
>>
dbgout
,
"BEFORE"
if
connectiontype
==
'Ssl'
:
if
connectiontype
==
'Ssl'
:
self
.
server
=
poplib
.
POP3_SSL
(
server
,
port
)
self
.
server
=
poplib
.
POP3_SSL
(
server
,
port
)
else
:
else
:
self
.
server
=
poplib
.
POP3
(
server
,
port
)
self
.
server
=
poplib
.
POP3
(
server
,
port
)
print
>>
sys
.
stderr
,
"AFTER"
print
>>
dbgout
,
"AFTER"
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
'Logging in, username of'
,
user
print
>>
dbgout
,
'Logging in, username of'
,
user
self
.
server
.
user
(
user
)
self
.
server
.
user
(
user
)
self
.
server
.
pass_
(
user
,
password
)
self
.
server
.
pass_
(
user
,
password
)
...
@@ -352,7 +359,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
...
@@ -352,7 +359,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
listener
.
connected
(
self
.
notify
)
listener
.
connected
(
self
.
notify
)
def
disconnect
(
self
):
def
disconnect
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service disconnect"
print
>>
dbgout
,
"PyMailPOP3Service disconnect"
if
self
.
server
:
if
self
.
server
:
self
.
server
.
quit
()
self
.
server
.
quit
()
self
.
server
=
None
self
.
server
=
None
...
@@ -360,21 +367,21 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
...
@@ -360,21 +367,21 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
listener
.
disconnected
(
self
.
notify
)
listener
.
disconnected
(
self
.
notify
)
def
isConnected
(
self
):
def
isConnected
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service isConnected"
print
>>
dbgout
,
"PyMailPOP3Service isConnected"
return
self
.
server
!=
None
return
self
.
server
!=
None
def
getCurrentConnectionContext
(
self
):
def
getCurrentConnectionContext
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service getCurrentConnectionContext"
print
>>
dbgout
,
"PyMailPOP3Service getCurrentConnectionContext"
return
self
.
connectioncontext
return
self
.
connectioncontext
class
PyMailServiceProvider
(
unohelper
.
Base
,
XMailServiceProvider
):
class
PyMailServiceProvider
(
unohelper
.
Base
,
XMailServiceProvider
):
def
__init__
(
self
,
ctx
):
def
__init__
(
self
,
ctx
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailServiceProvider init"
print
>>
dbgout
,
"PyMailServiceProvider init"
self
.
ctx
=
ctx
self
.
ctx
=
ctx
def
create
(
self
,
aType
):
def
create
(
self
,
aType
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailServiceProvider create with"
,
aType
print
>>
dbgout
,
"PyMailServiceProvider create with"
,
aType
if
aType
==
SMTP
:
if
aType
==
SMTP
:
return
PyMailSMTPService
(
self
.
ctx
);
return
PyMailSMTPService
(
self
.
ctx
);
elif
aType
==
POP3
:
elif
aType
==
POP3
:
...
@@ -382,12 +389,12 @@ class PyMailServiceProvider(unohelper.Base, XMailServiceProvider):
...
@@ -382,12 +389,12 @@ class PyMailServiceProvider(unohelper.Base, XMailServiceProvider):
elif
aType
==
IMAP
:
elif
aType
==
IMAP
:
return
PyMailIMAPService
(
self
.
ctx
);
return
PyMailIMAPService
(
self
.
ctx
);
else
:
else
:
print
>>
sys
.
stderr
,
"PyMailServiceProvider, unknown TYPE"
,
aType
print
>>
dbgout
,
"PyMailServiceProvider, unknown TYPE"
,
aType
class
PyMailMessage
(
unohelper
.
Base
,
XMailMessage
):
class
PyMailMessage
(
unohelper
.
Base
,
XMailMessage
):
def
__init__
(
self
,
ctx
,
sTo
=
''
,
sFrom
=
''
,
Subject
=
''
,
Body
=
None
,
aMailAttachment
=
None
):
def
__init__
(
self
,
ctx
,
sTo
=
''
,
sFrom
=
''
,
Subject
=
''
,
Body
=
None
,
aMailAttachment
=
None
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage init"
print
>>
dbgout
,
"PyMailMessage init"
self
.
ctx
=
ctx
self
.
ctx
=
ctx
self
.
recipients
=
sTo
,
self
.
recipients
=
sTo
,
...
@@ -402,38 +409,38 @@ class PyMailMessage(unohelper.Base, XMailMessage):
...
@@ -402,38 +409,38 @@ class PyMailMessage(unohelper.Base, XMailMessage):
self
.
Subject
=
Subject
self
.
Subject
=
Subject
self
.
Body
=
Body
self
.
Body
=
Body
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"post PyMailMessage init"
print
>>
dbgout
,
"post PyMailMessage init"
def
addRecipient
(
self
,
recipient
):
def
addRecipient
(
self
,
recipient
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addRecipient"
,
recipient
print
>>
dbgout
,
"PyMailMessage.addRecipient"
,
recipient
self
.
recipients
=
self
.
recipients
,
recipient
self
.
recipients
=
self
.
recipients
,
recipient
def
addCcRecipient
(
self
,
ccrecipient
):
def
addCcRecipient
(
self
,
ccrecipient
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addCcRecipient"
,
ccrecipient
print
>>
dbgout
,
"PyMailMessage.addCcRecipient"
,
ccrecipient
self
.
ccrecipients
=
self
.
ccrecipients
,
ccrecipient
self
.
ccrecipients
=
self
.
ccrecipients
,
ccrecipient
def
addBccRecipient
(
self
,
bccrecipient
):
def
addBccRecipient
(
self
,
bccrecipient
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addBccRecipient"
,
bccrecipient
print
>>
dbgout
,
"PyMailMessage.addBccRecipient"
,
bccrecipient
self
.
bccrecipients
=
self
.
bccrecipients
,
bccrecipient
self
.
bccrecipients
=
self
.
bccrecipients
,
bccrecipient
def
getRecipients
(
self
):
def
getRecipients
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getRecipients"
,
self
.
recipients
print
>>
dbgout
,
"PyMailMessage.getRecipients"
,
self
.
recipients
return
self
.
recipients
return
self
.
recipients
def
getCcRecipients
(
self
):
def
getCcRecipients
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getCcRecipients"
,
self
.
ccrecipients
print
>>
dbgout
,
"PyMailMessage.getCcRecipients"
,
self
.
ccrecipients
return
self
.
ccrecipients
return
self
.
ccrecipients
def
getBccRecipients
(
self
):
def
getBccRecipients
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getBccRecipients"
,
self
.
bccrecipients
print
>>
dbgout
,
"PyMailMessage.getBccRecipients"
,
self
.
bccrecipients
return
self
.
bccrecipients
return
self
.
bccrecipients
def
addAttachment
(
self
,
aMailAttachment
):
def
addAttachment
(
self
,
aMailAttachment
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addAttachment"
print
>>
dbgout
,
"PyMailMessage.addAttachment"
self
.
aMailAttachments
=
self
.
aMailAttachments
,
aMailAttachment
self
.
aMailAttachments
=
self
.
aMailAttachments
,
aMailAttachment
def
getAttachments
(
self
):
def
getAttachments
(
self
):
if
dbg
:
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getAttachments"
print
>>
dbgout
,
"PyMailMessage.getAttachments"
return
self
.
aMailAttachments
return
self
.
aMailAttachments
# pythonloader looks for a static g_ImplementationHelper variable
# pythonloader looks for a static g_ImplementationHelper variable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment