1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

add support of remote storage

This commit is contained in:
Youssef Badzi 2024-12-27 12:38:49 +01:00
parent 5a050b0ca3
commit 0be2afdec8
No known key found for this signature in database
GPG key ID: 4D8586DB91437E39

View file

@ -719,24 +719,22 @@ class Message(models.Model):
if encoding and encoding.lower() == 'quoted-printable': if encoding and encoding.lower() == 'quoted-printable':
# Cannot use `email.encoders.encode_quopri due to # Cannot use `email.encoders.encode_quopri due to
# bug 14360: http://bugs.python.org/issue14360 # bug 14360: http://bugs.python.org/issue14360
with open(attachment.document.path, 'rb') as f: output = BytesIO()
output = BytesIO() encode_quopri(
encode_quopri( BytesIO(
BytesIO( attachment.document.read()
f.read() ),
), output,
output, quotetabs=True,
quotetabs=True, header=False,
header=False, )
) new.set_payload(
new.set_payload( output.getvalue().decode().replace(' ', '=20')
output.getvalue().decode().replace(' ', '=20') )
)
del new['Content-Transfer-Encoding'] del new['Content-Transfer-Encoding']
new['Content-Transfer-Encoding'] = 'quoted-printable' new['Content-Transfer-Encoding'] = 'quoted-printable'
else: else:
with open(attachment.document.path, 'rb') as f: new.set_payload(attachment.document.read())
new.set_payload(f.read())
del new['Content-Transfer-Encoding'] del new['Content-Transfer-Encoding']
encode_base64(new) encode_base64(new)
except MessageAttachment.DoesNotExist: except MessageAttachment.DoesNotExist: