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
4166969f
Kaydet (Commit)
4166969f
authored
Ock 16, 2012
tarafından
Ariel Constenla-Haile
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i118736 - i118787 : fix XMailMessage implementation in mailmerge.py
üst
91a17ad2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
mailmerge.py
scripting/source/pyprov/mailmerge.py
+27
-23
No files found.
scripting/source/pyprov/mailmerge.py
Dosyayı görüntüle @
4166969f
...
...
@@ -52,7 +52,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self
.
supportedtypes
=
(
'Insecure'
,
'Ssl'
)
self
.
server
=
None
self
.
connectioncontext
=
None
self
.
notify
=
EventObject
()
self
.
notify
=
EventObject
(
self
)
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailSMPTService init"
def
addConnectionListener
(
self
,
xListener
):
...
...
@@ -83,7 +83,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
print
>>
sys
.
stderr
,
connectiontype
if
connectiontype
==
'Ssl
'
:
if
connectiontype
.
upper
()
==
'SSL
'
:
self
.
server
.
ehlo
()
self
.
server
.
starttls
()
self
.
server
.
ehlo
()
...
...
@@ -180,7 +180,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
mailerstring
=
"OpenOffice.org 2.0 via Caolan's mailmerge component"
try
:
ctx
=
uno
.
getComponentContext
()
ctx
=
uno
.
getComponentContext
()
aConfigProvider
=
ctx
.
ServiceManager
.
createInstance
(
"com.sun.star.configuration.ConfigurationProvider"
)
prop
=
uno
.
createUnoStruct
(
'com.sun.star.beans.PropertyValue'
)
prop
.
Name
=
"nodepath"
...
...
@@ -191,7 +191,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
aSettings
.
getByName
(
"ooSetupVersion"
)
+
" via Caolan's mailmerge component"
except
:
pass
msg
[
'X-Mailer'
]
=
mailerstring
msg
[
'Date'
]
=
formatdate
(
localtime
=
True
)
...
...
@@ -206,9 +206,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
msgattachment
.
set_payload
(
data
)
Encoders
.
encode_base64
(
msgattachment
)
msgattachment
.
add_header
(
'Content-Disposition'
,
'attachment'
,
\
filename
=
attachment
.
ReadableName
)
filename
=
(
'utf-8'
,
''
,
attachment
.
ReadableName
.
encode
(
'utf-8'
))
)
msg
.
attach
(
msgattachment
)
uniquer
=
{}
for
key
in
recipients
:
uniquer
[
key
]
=
True
...
...
@@ -232,6 +233,7 @@ class PyMailIMAPService(unohelper.Base, XMailService):
self
.
supportedtypes
=
(
'Insecure'
,
'Ssl'
)
self
.
server
=
None
self
.
connectioncontext
=
None
self
.
notify
=
EventObject
(
self
)
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailIMAPService init"
def
addConnectionListener
(
self
,
xListener
):
...
...
@@ -261,12 +263,12 @@ class PyMailIMAPService(unohelper.Base, XMailService):
if
dbg
:
print
>>
sys
.
stderr
,
connectiontype
print
>>
sys
.
stderr
,
"BEFORE"
if
connectiontype
==
'Ssl
'
:
if
connectiontype
.
upper
()
==
'SSL
'
:
self
.
server
=
imaplib
.
IMAP4_SSL
(
server
,
port
)
else
:
self
.
server
=
imaplib
.
IMAP4
(
server
,
port
)
print
>>
sys
.
stderr
,
"AFTER"
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
user
!=
''
:
...
...
@@ -300,6 +302,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
self
.
supportedtypes
=
(
'Insecure'
,
'Ssl'
)
self
.
server
=
None
self
.
connectioncontext
=
None
self
.
notify
=
EventObject
(
self
)
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailPOP3Service init"
def
addConnectionListener
(
self
,
xListener
):
...
...
@@ -329,18 +332,18 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
if
dbg
:
print
>>
sys
.
stderr
,
connectiontype
print
>>
sys
.
stderr
,
"BEFORE"
if
connectiontype
==
'Ssl
'
:
if
connectiontype
.
upper
()
==
'SSL
'
:
self
.
server
=
poplib
.
POP3_SSL
(
server
,
port
)
else
:
self
.
server
=
poplib
.
POP3
(
server
,
port
)
print
>>
sys
.
stderr
,
"AFTER"
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
dbg
:
print
>>
sys
.
stderr
,
'Logging in, username of'
,
user
self
.
server
.
user
(
user
)
self
.
server
.
pass_
(
user
,
password
)
self
.
server
.
pass_
(
password
)
for
listener
in
self
.
listeners
:
listener
.
connected
(
self
.
notify
)
...
...
@@ -384,12 +387,12 @@ class PyMailMessage(unohelper.Base, XMailMessage):
print
>>
sys
.
stderr
,
"PyMailMessage init"
self
.
ctx
=
ctx
self
.
recipients
=
sTo
,
self
.
ccrecipients
=
()
self
.
bccrecipients
=
()
self
.
aMailAttachments
=
()
self
.
recipients
=
[
sTo
]
self
.
ccrecipients
=
[]
self
.
bccrecipients
=
[]
self
.
aMailAttachments
=
[]
if
aMailAttachment
!=
None
:
self
.
aMailAttachments
=
aMailAttachment
,
self
.
aMailAttachments
.
append
(
aMailAttachment
)
self
.
SenderName
,
self
.
SenderAddress
=
parseaddr
(
sFrom
)
self
.
ReplyToAddress
=
sFrom
...
...
@@ -400,35 +403,36 @@ class PyMailMessage(unohelper.Base, XMailMessage):
def
addRecipient
(
self
,
recipient
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addRecipient"
,
recipient
self
.
recipients
=
self
.
recipients
,
recipient
self
.
recipients
.
append
(
recipient
)
def
addCcRecipient
(
self
,
ccrecipient
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addCcRecipient"
,
ccrecipient
self
.
ccrecipients
=
self
.
ccrecipients
,
ccrecipient
self
.
ccrecipients
.
append
(
ccrecipient
)
def
addBccRecipient
(
self
,
bccrecipient
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addBccRecipient"
,
bccrecipient
self
.
bccrecipients
=
self
.
bccrecipients
,
bccrecipient
self
.
bccrecipients
.
append
(
bccrecipient
)
def
getRecipients
(
self
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getRecipients"
,
self
.
recipients
return
self
.
recipients
return
tuple
(
self
.
recipients
)
def
getCcRecipients
(
self
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getCcRecipients"
,
self
.
ccrecipients
return
self
.
ccrecipients
return
tuple
(
self
.
ccrecipients
)
def
getBccRecipients
(
self
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getBccRecipients"
,
self
.
bccrecipients
return
self
.
bccrecipients
return
tuple
(
self
.
bccrecipients
)
def
addAttachment
(
self
,
aMailAttachment
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.addAttachment"
self
.
aMailAttachments
=
self
.
aMailAttachments
,
aMailAttachment
self
.
aMailAttachments
.
append
(
aMailAttachment
)
def
getAttachments
(
self
):
if
dbg
:
print
>>
sys
.
stderr
,
"PyMailMessage.getAttachments"
return
self
.
aMailAttachments
return
tuple
(
self
.
aMailAttachments
)
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper
=
unohelper
.
ImplementationHelper
()
...
...
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