Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[flake8]
exclude = django_mailbox/migrations, django_mailbox/south_migrations
exclude = django_mailbox/migrations
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'

steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

Unreleased
-----

* Add Python 3.13, 3.14 support
* Add Django 5.1, 5.2, 6.0 support
* Remove support for deprecated Django versions

4.9.0
-----

Expand Down
7 changes: 3 additions & 4 deletions django_mailbox/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def _get_dehydrated_message(self, msg, record):
)
elif (
settings['strip_unallowed_mimetypes']
and not msg.get_content_type() in settings['allowed_mimetypes']
and msg.get_content_type() not in settings['allowed_mimetypes']
):
for header, value in msg.items():
new[header] = value
Expand Down Expand Up @@ -674,10 +674,9 @@ def reply(self, message):
message.extra_headers['Date'] = formatdate()
message.extra_headers['In-Reply-To'] = self.message_id.strip()
message.send()

return self.mailbox.record_outgoing_message(
email.message_from_string(
message.message().as_string()
)
Comment on lines -678 to -680
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be misunderstanding what you wrote in your PR description, but won't this only work for Django 6+, while I believe you've left the repo set to continue supporting 5?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @coddingtonbear,
the main change in Django 6.0 is that message.message() now returns a <class 'email.message.EmailMessage'> instead of <class 'django.core.mail.message.SafeMIMEText'>.
But the new class, when serialized-deserialized as string, does not preserve custom headers like In-Reply-To.

I started with a Django 6 only fix, but it appeared that the serialization-deserialization wasn't useful (according to the test suite)
But I can definitely add a statement to apply it only for Django6+

message.message()
)

@property
Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
norecursedirs=env docs lib .eggs
DJANGO_SETTINGS_MODULE=django_mailbox.tests.settings
addopts = --tb=short -rxs

[tool:pytest]
norecursedirs=env docs lib .eggs
DJANGO_SETTINGS_MODULE=django_mailbox.tests.settings
addopts = --tb=short -rxs
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
'Framework :: Django :: 5.2',
'Framework :: Django :: 6.0',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
Expand Down
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# sort by django version, next by python version
envlist=
flake8
py{312,313,314}-django60
py{310,311,312,313,314}-django52
py{310,311,312}-django51
py{310,311,312}-django50
py{38,39,310,311}-django42
py{38,39,310,311}-django41
py{38,39,310}-django40
py{38,39,310}-django32

[gh-actions]
python =
Expand All @@ -23,11 +23,11 @@ passenv=
EMAIL_PASSWORD
EMAIL_SMTP_SERVER
deps=
django60: Django>=6.0,<6.1
django52: Django>=5.2,<6.0
django51: Django>=5.1,<5.2
django50: Django==5.0,<5.1
django42: Django>=4.2,<5.0
django41: Django>=4.1,<4.2
django40: Django>=4.0,<4.1
django32: Django>=3.2,<4.0
-r{toxinidir}/test_requirements.txt
sitepackages=False
commands=
Expand Down