Mariusz Felisiak
6a16d53039
[4.0.x] Refs #32074 -- Removed usage of deprecated asyncore and smtpd modules.
...
asyncore and smtpd modules were deprecated in Python 3.10.
Backport of 569a33579c
from main
2021-10-15 09:58:53 +02:00
Mariusz Felisiak
8ab95364b5
[4.0.x] Refs #27131 -- Removed SMTPBackendTests.test_server_login().
...
test_server_login() was a regression test for a crash when passing
Unicode strings to SMTP server using CRAM-MD5 method on Python 2.
Python 2 is no longer supported and test_server_login() passes even
without FakeSMTPChannel.smtp_AUTH() because
smtplib.SMTPAuthenticationError is raised when AUTH is not implemented.
Backport of cdad96e633
from main
2021-10-14 11:37:53 +02:00
Mariusz Felisiak
213850b4b9
Refs #32355 -- Used addClassCleanup() in tests.
...
Inspired by Adam Johnson talk on DjangoCon Europe 2021.
2021-06-04 12:53:11 +02:00
Daniyal
474cc420bf
Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.core.
2021-03-19 08:04:37 +01:00
Konstantin Alekseev
e5118b545b
Used mock.Mock() in SMTPBackendTests.
...
Using bool caused mypy typecheck failures.
2020-08-07 20:31:47 +02:00
Florian Apolloner
96a3ea39ef
Fixed #31784 -- Fixed crash when sending emails on Python 3.6.11+, 3.7.8+, and 3.8.4+.
...
Fixed sending emails crash on email addresses with display names longer
then 75 chars on Python 3.6.11+, 3.7.8+, and 3.8.4+.
Wrapped display names were passed to email.headerregistry.Address()
what caused raising an exception because address parts cannot contain
CR or LF.
See https://bugs.python.org/issue39073
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-07-20 07:10:40 +02:00
Mariusz Felisiak
f405954ea2
Refs #31784 -- Added test for preventing header injection in display name of email addresses.
2020-07-20 07:10:16 +02:00
Jon Dufresne
505fec6bad
Capitalized Unicode in docs, strings, and comments.
2020-04-20 12:10:33 +02:00
Jon Dufresne
e3c2fae4cd
Adjusted expected exception message for Windows.
...
Test failure introduced in fbbff7f808
.
Windows uses a different error message when a non-path is passed to
os.path functions.
2019-11-06 14:34:44 +01:00
Jon Dufresne
fbbff7f808
Refs #29983 -- Added pathlib.Path support to the file email backend.
2019-11-06 09:33:07 +01:00
Chason Chaffin
55b68de643
Fixed #30608 -- Fixed non-unicode EmailMessage crash when domain name for localhost is non-ASCII.
...
Assisted by felixxm.
2019-07-03 10:49:03 +02:00
Hasan Ramezani
090ca6512f
Fixed #30604 -- Made mail_admins()/mail_managers() raise ValueError if ADMINS/MANAGERS is set incorrectly.
2019-07-02 07:34:07 +02:00
Carlton Gibson
1564e42ad3
Refs #30512 , #15042 -- Added local-only address to sanitize_email() tests cases.
...
email.headerregistry.parser.get_mailbox() returns a token with a `token_type` attribute.
If `token_type` is `’invalid-mailbox’` then RFC violations have been detected. Emails with only the local part, and no domain, are correctly parsed but are marked as `’invalid-mailbox’`.
As per #15042 , local-only are supported, to enable sending to addresses on localhost.
sanitize_email() does not currently check `token_type`. This test is added to avoid a regression in case this is revisited in the future.
2019-06-13 17:29:58 +02:00
Joachim Jablon
2628ea9515
Fixed #30512 -- Used email.headerregistry.parser for parsing emails in sanitize_address().
2019-06-13 16:22:15 +02:00
Joachim Jablon
8ba20d9071
Refs #30512 -- Added tests for sanitizing email addresses with display name and two @ signs.
2019-06-06 15:05:56 +02:00
Joachim Jablon
f841a776fe
Refs #30512 -- Used subTest() in MailTests.test_sanitize_address.
2019-06-06 14:50:40 +02:00
Sergey Fedoseev
1933e56eca
Removed uneeded generator expressions and list comprehensions.
2019-02-09 09:18:48 -05:00
Tim Graham
7e6b214ed3
Fixed #30116 -- Dropped support for Python 3.5.
2019-01-30 10:19:48 -05:00
Jon Dufresne
7785e03ba8
Fixed #30137 -- Replaced OSError aliases with the canonical OSError.
...
Used more specific errors (e.g. FileExistsError) as appropriate.
2019-01-28 11:15:06 -05:00
Tim Graham
0004daa536
Used 4 space hanging indent for dictionaries.
...
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Denis Stebunov
277de22984
Fixed #30058 -- Made SMTP EmailBackend.send_messages() return 0 for empty/error cases.
2018-12-26 13:33:08 -05:00
jannschu
efc0f77f02
Fixed #29830 -- Fixed loss of custom utf-8 body encoding in mails.
2018-10-22 15:21:33 -04:00
Tim Graham
ec594942cd
Removed unnecessary str() in mail tests.
...
Unnecessary since their introduction in
fa75b2cb51
.
2018-08-04 10:15:51 -04:00
Mariusz Felisiak
362813d628
Fixed hanging indentation in various code.
2018-03-16 10:54:34 +01:00
Williams Mendez
2691ed7ba1
Fixed #29140 -- Fixed EmailMessage crash when body is None.
2018-02-20 09:34:01 -05:00
Tim Graham
fa75b2cb51
Refs #27795 -- Removed force_bytes/text() usage in tests.
2018-02-07 14:20:04 -05:00
Mads Jensen
999fc0687d
Added a few tests for smtp EmailBackend.
2018-01-15 12:25:17 -05:00
Jon Dufresne
da82939e5a
Fixed #28912 -- Made EmailMessage.message() omit an empty To header.
2017-12-30 09:38:03 -05:00
Jon Dufresne
b03d500295
Fixed #28971 -- Made EmailMessage.message() set Cc from headers dict if it exists.
2017-12-30 09:37:59 -05:00
Jon Dufresne
6334939417
Tested passing To/Cc/Reply-To in EmailMessage(headers=...) without the corresponding argument.
2017-12-29 12:50:31 -05:00
Tim Graham
cfff2af02b
Fixed #27857 -- Dropped support for Python 3.4.
2017-09-25 17:11:03 -04:00
Tim Graham
6e4c6281db
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
...
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Igor Tokarev
af35c69a3c
Fixed #26344 -- Made EmailMessage include alternatives when the body is empty and it has attachments.
2017-09-04 08:46:11 -04:00
Mads Jensen
550cb3a365
Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().
2017-06-28 14:07:55 -04:00
kalombo
dd00184892
Fixed #28042 -- Fixed crash when using a two-tuple in EmailMessage's attachments arg.
2017-04-07 18:02:34 -04:00
kalombo
aedfe0ddd7
Tested EmailMessage(attachments=[MIMEText])
2017-04-07 18:01:31 -04:00
Claude Paroz
9a9e228321
Fixed #27848 -- Prevented crash when attaching a .eml file to a message
...
Thanks Sébastien Ramage for the report.
2017-04-01 16:19:03 +02:00
Claude Paroz
8346680e1c
Refs #27795 -- Removed unneeded force_text calls
...
Thanks Tim Graham for the review.
2017-03-04 18:18:21 +01:00
Tim Graham
500532c95d
Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode().
2017-02-09 09:03:47 -05:00
Claude Paroz
c651331b34
Converted usage of ugettext* functions to their gettext* aliases
...
Thanks Tim Graham for the review.
2017-02-07 09:04:04 +01:00
Chillar Anand
6478e07a62
Refs #23919 -- Replaced tempfile.mkdtemp() with TemporaryDirectory() context manager.
2017-01-26 13:54:16 -05:00
Tim Graham
1c466994d9
Refs #23919 -- Removed misc Python 2/3 references.
2017-01-25 13:59:25 -05:00
chillaranand
d6eaf7c018
Refs #23919 -- Replaced super(ClassName, self) with super().
2017-01-25 12:23:46 -05:00
Claude Paroz
042b7350a0
Refs #23919 -- Removed unneeded str() calls
2017-01-20 14:13:55 +01:00
Tim Graham
4e729feaa6
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
...
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Simon Charette
cecc079168
Refs #23919 -- Stopped inheriting from object to define new style classes.
2017-01-19 08:39:46 +01:00
Claude Paroz
2b281cc35e
Refs #23919 -- Removed most of remaining six usage
...
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Claude Paroz
7b2f2e74ad
Refs #23919 -- Removed six.<various>_types usage
...
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz
c716fe8782
Refs #23919 -- Removed six.PY2/PY3 usage
...
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz
d7b9aaa366
Refs #23919 -- Removed encoding preambles and future imports
2017-01-18 09:55:19 +01:00