Compare commits

..

No commits in common. "72d7fdd05fa555fff3221c31485fc478064aa964" and "8a578b46a883f2a021434b674be0afb15f2ae4f0" have entirely different histories.

2 changed files with 3 additions and 20 deletions

View file

@ -195,8 +195,8 @@ class SendEmail(FormController):
# TODO: remove duplicates
person = getPersonForUser(self.context, self.request)
sender = person and adapted(person).email or 'loops@unknown.com'
msg = MIMEText(message, 'plain', 'utf-8')
msg['Subject'] = subject
msg = MIMEText(message.encode('utf-8'), 'plain', 'utf-8')
msg['Subject'] = subject.encode('utf-8')
msg['From'] = sender
recipients = [r.strip() for r in recipients if r.strip()]
msg['To'] = ', '.join(recipients)

View file

@ -5,6 +5,7 @@
import zope.index.text.widcode
from zope.index.text.widcode import _prog, _decode, _decoding
def patched_decode(code):
"""_prog pattern is now a string, but after updating from Python2
code is still a bytes array."""
@ -16,21 +17,3 @@ def patched_decode(code):
zope.index.text.widcode.decode = patched_decode
print("loops.patch: monkey patch for 'zope.index.text.widcode.decode()' installed.")
from zope.sendmail.interfaces import IMailer
from zope.sendmail.mailer import SMTPMailer
def patched_smtpMailer(_context, name, hostname="localhost", port="25",
username=None, password=None, implicit_tls=False):
_context.action(
discriminator=('utility', IMailer, name),
callable=handler,
args=('registerUtility',
# fix error: set 'implicit_tls' as a keyword parameter
SMTPMailer(hostname, port, username, password,
implicit_tls=implicit_tls),
IMailer, name)
)
import zope.sendmail.zcml
zope.sendmail.zcml.smtpMailer = patched_smtpMailer
print("loops patch: monkey patch for 'zope.sendmail.zcml.smtpMailer()' installed")