Commit Graph

66 Commits

Author SHA1 Message Date
Christopher Broderick
8849943d33 Add logging to stdout when enabled to facilitate debugging issues. 2023-10-24 13:50:23 +01:00
Timothy Hobbs
405efcc33b Delete emails immediately to prevent duplicate ticket problems
Right now if there is an exception in this loop due to a single messed up
email (perhapse an invalid email address), the loop will fail without deleting
the already processed emails. In a few hours you can end up with hundreds of
duplicate tickets. This way, the already processed emails will be deleted and
not processed again.
2023-10-14 18:48:02 +02:00
Christopher Broderick
e90739a07a Fix formatting issues 2023-10-10 14:08:57 +01:00
Christopher Broderick
8006826ddf Process email content first then focus on attachments.
Use the EmailMessage class for enhanced processing.
2023-10-10 13:41:28 +01:00
Christopher Broderick
9bbe1945b0 Fix format errors 2023-07-23 06:31:29 +01:00
Christopher Broderick
2e5697c11a Completely rework the email parsing.
Fixes a number of hacks that have accumulated and makes it is more
easily understood and easier to enhance in the future.
2023-07-23 06:12:32 +01:00
Christopher Broderick
707cc6761b Implement a recursive multipart parser to cater for attachments that
have embedded attachments.
2023-07-16 14:55:18 +01:00
bruce.gibbins
c23c8e5be6 Add user defined IMAP Debug Level and improved exception message 2023-04-19 20:07:43 +10:00
bruce.gibbins
a8fbeaa140 Fix OAuth tests 2023-04-19 15:22:35 +10:00
bruce.gibbins
012cc7041a Fix OAuth tests 2023-04-19 15:12:13 +10:00
bruce.gibbins
101326c987 Use settings instead of django_settings 2023-04-17 20:08:56 +10:00
bruce.gibbins
c29996df94 Resorted imports for pep8 2023-04-17 13:15:47 +10:00
bruce.gibbins
9192779889 Add IMAP OAUTH Mail Box Type 2023-04-15 22:11:41 +10:00
bruce.gibbins
d7ebc8e1c2 Revert "Add IMAP OAUTH Mail Box Type"
This reverts commit d57f11f40a.
2023-04-15 21:56:05 +10:00
bruce.gibbins
d57f11f40a Add IMAP OAUTH Mail Box Type 2023-04-15 21:52:44 +10:00
Bruce
287024acd1 Use updated_submitter email template in send for updated ticket 2023-03-28 19:45:54 +10:00
Christopher Broderick
8cb3d43311 Use simpler conversion to string 2023-03-25 13:25:22 +00:00
Christopher Broderick
4cd66d7e0c Fix import format fail 2023-03-25 13:21:38 +00:00
Christopher Broderick
cdbd531931 Ensure multipart attachments are saved 2023-03-25 13:06:03 +00:00
Christopher Broderick
7f8e996668 Fix missing param in call 2023-03-10 22:11:34 +00:00
Christopher Broderick
aad73a5d90 Fix format errors 2023-03-10 22:06:14 +00:00
Benbb96
b3edba3fc5 Fix #1054 2022-10-09 23:05:16 +02:00
chrisbroderick
9e3a3abcf1 Fix import sorting 2022-09-08 23:40:49 +01:00
chrisbroderick
8d7ba415fa Fix formatting per flake8 2022-09-08 22:11:24 +01:00
chrisbroderick
eca2255f56 Test for filename using diaretics 2022-09-08 10:05:09 +01:00
chrisbroderick
572ffd5acf Handle ignored emails explicitly using exceptions.
Support the flag on IgnoreEmail model to control deleting the email if
ignored.
2022-09-06 19:40:35 +01:00
chrisbroderick
23c3b72a43 Refactor object_from_message to make it more testable and fix some bugs.
Extract the from email using the email library instead of pre-decoding
which exposes the comma separator causing the email address to be
extracted incorrectly if the real name contains a comma.
Raise an exception when a message to be ignored is detected to process
ignored messages explicitly.
2022-09-04 22:01:32 +01:00
Martin Whitehouse
46f8e9d21f
Clear error
Use.objects.get causes undefined variable when using get_user_model
2022-07-25 03:52:58 +02:00
Martin Whitehouse
1468982043
Remove unused variables, extract correct index 2022-07-25 03:50:49 +02:00
Martin Whitehouse
57cd2f1471
Remove annoation for py3.8 2022-07-25 03:47:57 +02:00
Martin Whitehouse
8d63d65a7d
Removed encoding to 'utf-8', breaks tests.
This needs to be looked into further.
2022-07-25 02:41:40 +02:00
Martin Whitehouse
4e2b7deefb
Reduces complexity of object_from_message
Helper functions created to help break up the flow
2022-07-25 02:22:32 +02:00
Martin Whitehouse
a5e74d6449
Extract getting ticket_id from subject to helper function 2022-07-25 01:56:13 +02:00
Martin Whitehouse
283f052c0e
Annotate function signature 2022-07-25 01:47:00 +02:00
Martin Whitehouse
80f4152301
Simplify return statement
Rename `ticket` to `ticket_id` for clarity
2022-07-25 01:43:43 +02:00
Martin Whitehouse
0b1de1eead
Removed unused import
Result of previous code removal
2022-07-25 01:23:12 +02:00
Martin Whitehouse
fe28c2f540
Merge branch 'unstable' of git@github.com:martin-marty/django-helpdesk.git into 1039-complexity-reduction 2022-07-25 01:22:11 +02:00
Martin Whitehouse
1ac78955c0
Removed notifications_to_be_sent list
The whole loop appeared to be doing nothing other than appending email
addresses to a list, which was never used.
2022-07-25 01:22:05 +02:00
Martin Whitehouse
0f0b0a5995
Remove left over 'cc' code 2022-07-22 16:27:38 +02:00
Martin Whitehouse
25542f929e
Initial isort configuration
Will fail build if imports are not sorted correctly
2022-07-22 03:26:41 +02:00
Martin Whitehouse
aa876f8016
pycodestyle formatting 2022-07-12 12:34:19 +02:00
Nick McCullum
358080926c Added Django 4 support. 2022-03-16 22:29:09 -04:00
Brendan Wood
6a0b367171 fix: strip extraneous whitespace characters that are returned in the Message-ID and In-Reply-To fields from some email providers 2021-09-23 10:07:12 -03:00
Arkadiy Korotaev
3285d5e1a8 feat(emails): Do not auto-reply on auto-replies and add auto-reply header for auto-replies and fix headers propagation for our email messages 2021-04-20 12:44:27 +02:00
Arkadiy Korotaev
2b4c82fd1b
fix(email): Add ability to attach full first email text to avoid losing forwards, and to save .eml files for any incoming mesages, plus fix tests and some minor bugs 2021-04-19 21:15:24 +02:00
Garret Wassermann
012ba4f42d
Update email.py
Correct a typo so that imap code calls starttls() correctly.
2021-03-26 03:48:10 -04:00
Brendan Wood
9f99eb5ee6 fix: prepend file attachments with 'part-%i_' to prevent name collisions when an email has attachments with the same filename 2021-03-08 13:57:07 -04:00
Garret Wassermann
959fc0f9ba
Merge pull request #911 from koriaf/dev-configurable-file-log
ifix(email): Create the log file only if required
2020-12-04 11:08:43 -05:00
Evili del Rio
baa763c784 Add support for standard STARTTLS on port 143 (RFC 2595).
Signed-off-by: Evili del Rio <evili.del.rio@gmail.com>
2020-12-04 11:49:20 +01:00
Arkadiy Korotaev
d2a7bad576
ifix(email): Create the log file only if required
+ update some translations
+ update some tests to correctly mock unlink as well
+ fix flake8 errors and sort the imports in email module
+ update some log messages to pass base message + parameters instead of rendered string (works better with Sentry)
2020-11-25 10:31:40 +01:00