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
c25bee9c
Kaydet (Commit)
c25bee9c
authored
Ock 15, 2013
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
make emailmerge work with python3 and python2 at the same time
Change-Id: I6289b522513a2fc86e261c85a04ca9c89fd55b63
üst
5cd7c890
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
mailmerge.py
scripting/source/pyprov/mailmerge.py
+12
-5
No files found.
scripting/source/pyprov/mailmerge.py
Dosyayı görüntüle @
c25bee9c
...
...
@@ -11,6 +11,8 @@
# <value>true</value>
# </prop>
from
__future__
import
print_function
import
unohelper
import
uno
import
re
...
...
@@ -171,8 +173,6 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if
dbg
:
print
(
"PyMailSMTPService mimetype is: "
+
flavor
.
MimeType
,
file
=
dbgout
)
textbody
=
content
.
getTransferData
(
flavor
)
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
textbody
=
textbody
.
encode
(
'utf-8'
)
.
decode
(
'iso8859-1'
)
if
len
(
textbody
):
mimeEncoding
=
re
.
sub
(
"charset=.*"
,
"charset=UTF-8"
,
flavor
.
MimeType
)
...
...
@@ -180,9 +180,16 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
mimeEncoding
=
mimeEncoding
+
"; charset=UTF-8"
textmsg
[
'Content-Type'
]
=
mimeEncoding
textmsg
[
'MIME-Version'
]
=
'1.0'
c
=
Charset
(
'utf-8'
)
c
.
body_encoding
=
QP
textmsg
.
set_payload
(
textbody
,
c
)
textbody
=
textbody
.
encode
(
'utf-8'
)
if
sys
.
version
>=
'3'
:
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
textbody
=
textbody
.
decode
(
'iso8859-1'
)
c
=
Charset
(
'utf-8'
)
c
.
body_encoding
=
QP
textmsg
.
set_payload
(
textbody
,
c
)
else
:
textmsg
.
set_payload
(
textbody
)
break
...
...
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