Commit graph

156 commits

Author SHA1 Message Date
Doridel Cahanap Mendez
4b2730642d refactor: attach txt file in received emails
(cherry picked from commit a36d6a9df02e9a86e3701fcc6861c9c64bd40c66)
2023-05-26 11:45:03 +00:00
Ankush Menat
715dc569e9
fix: reload communication before re-save (#20914) 2023-05-06 15:51:07 +05:30
phot0n
97b2adfaf2 chore: rename message_meta -> uid 2023-04-18 19:36:12 +05:30
phot0n
2a5ed28777 fix: make_error_msg for imap 2023-04-18 19:12:54 +05:30
phot0n
f6606781fb chore: take out email_list to function scope 2023-04-18 14:33:05 +05:30
Ritwik Puri
6ae91fb3b6
Merge branch 'develop' into email-retrieve-cleanup 2023-04-18 14:23:21 +05:30
phot0n
b483deac3d refactor(minor): email retreiveing 2023-04-18 14:01:11 +05:30
Ankush Menat
a2f40290d8
fix: bump poplib limit (#20739)
* fix: bump poplib limit

* Update receive.py

[skip ci]
2023-04-17 16:52:41 +05:30
phot0n
c7632d0e51 fix: use frappe.log_error in EmailServer exception handling 2023-04-12 13:20:32 +05:30
Ankush Menat
fdcdb61a2d
fix: email linking and message_id indexing (#20356)
* fix: find communication regardless of system reply

* perf: convert and index message_id
2023-03-16 14:01:25 +05:30
barredterra
3694e654a1 refactor: rename convert_utc_to_user_timezone to convert_utc_to_system_timezone 2023-03-04 19:02:25 +01:00
Ritwik Puri
92ca30074b
fix: dont get message attribute in error string in has_login_limit_exceeded 2023-03-02 15:59:34 +05:30
phot0n
f0a17d7adb fix: make connected app work with email account
* removed (now) unnecessary things from oauth class
* simplified get_active_token in connected_app
* removed gmail banner from email account docs
2022-12-28 14:58:19 +05:30
Ankush Menat
bbcc365a24
fix: use monotonic clock for timing code (#19138)
* fix: use monotonic time for timing code

`time.time()` depends on system clock which can drift away and get corrected
over time. If you're unlucky it will get corrected in your timing code
and give absurd results.

* test: dont check for status

can refresh and give wrong output

[skip ci]
2022-12-06 15:42:37 +05:30
Andrew McLeod
01fe2da368
fix(email): generate random filename when attachment filenames are same upon inbound email (#18483)
Fix issue when an email has multiple inline images with the same filename. Currently the cid_map is overwritten; instead, attach the files with different names. Emails where every inline image has the filename 'image.png', only one of the images ends up correctly linked.
2022-10-24 00:37:49 +05:30
HENRY Florian
11a17d3867
feat: STARTTLS authentication for IMAP (#17683)
Co-authored-by: phot0n <ritwikpuri5678@gmail.com>
2022-08-19 13:40:06 +05:30
phot0n
064ffef8b9 minor: throw exception if refresh_token is not present 2022-07-13 12:05:46 +05:30
phot0n
06c5a7226d chore: fix linter 2022-07-13 12:05:46 +05:30
phot0n
ebc5861210 feat: generic OAuth for email 2022-07-13 12:05:46 +05:30
phot0n
07a577af86 feat: google oauth for google emails
* used unique constraint on email_id in Email Account Doctype
2022-07-13 12:05:46 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Ankush Menat
d35d7ffbe2 fix: remove bare exception catching
A bare except catches lots of things (like generator iteration end) and should never be used.
2022-06-28 18:05:00 +05:30
Gavin D'souza
b696fa6da5 perf: Pre-compile and re-use regexp pattern
Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.

Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc
2022-06-08 14:07:38 +05:30
Gavin D'souza
5ec2690160 Merge branch 'develop' into refactor-file 2022-06-01 15:47:55 +05:30
Shariq Ansari
8f245be460
fix: Strip all spacing characters from Message-ID & In-Reply-To (#16999) 2022-05-27 21:06:07 +05:30
Gavin D'souza
1d84483289 Merge branch 'develop' of github.com:frappe/frappe into refactor-file 2022-04-21 11:45:50 +05:30
Rushabh Mehta
57a55e4225 feat(minor): Add document reference to Error Log and doc.log_error 2022-04-18 17:29:03 +05:30
Gavin D'souza
97e911e069 Merge branch 'develop' of github.com:frappe/frappe into refactor-file 2022-04-13 10:49:26 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
c6bad81f24 fix: Use new direct import paths
The old paths worked too, but it's just better to use the new paths and
not go in circles ;)
2022-03-15 19:39:47 +05:30
ChillarAnand
b2fc959307 refactor: Clean up whitespace & add CI check 2022-02-25 20:01:29 +05:30
kamaljohnson
ffbf215070 fix: communication if is_first and no append_to issue 2022-02-02 11:29:43 +05:30
kamaljohnson
12442726c6 fix: reply emails get_reference_doc from communication issue 2022-02-02 11:00:39 +05:30
kamaljohnson
f960fb70dc fix: append_to in case of not passed issue 2022-02-02 10:29:09 +05:30
kamaljohnson
eb574ca9f1 feat: add filter for append_to wrt imap_folder 2022-02-01 19:01:41 +05:30
kamaljohnson
57a6ee392a fix: append_to parameter order in InboundMail 2022-02-01 11:00:50 +05:30
kamaljohnson
7829de9862 fix: auto creation of append to doctype ref while receiving mail 2022-02-01 06:22:39 +05:30
Summayya Hashmani
645fde2e67
fix: email fetch error for imaplib (#15581)
* fix: remove maxline for imaplib

* refactor: remove redundant line

Co-authored-by: Summayya <frappe@Summayyas-MacBook-Air.local>
2022-01-11 08:11:38 +00:00
mtraeber
e0712171a6 fix: frappe-linter, all queries in email_account.py and receive.py rewritten
according to these specifications: https://frappeframework.com/docs/user/en/api/query-builder
2021-11-23 15:54:00 +01:00
mtraeber
151768d1d9 added method param again after merge 2021-11-03 09:36:00 +01:00
mtraeber
8a7889b928 Merge branch 'develop' into multiple_imap_folder 2021-11-03 08:55:29 +01:00
Ankush Menat
af4ce8156d
fix: remove mutable defaults (#14597)
* fix: mutable defaults

* fix: missing defaults
2021-10-28 09:36:31 +00:00
mtraeber
f608fbeddd feat: sync mutliple IMAP folders in Email Account
When working with IMAP accounts, frappe should allow the user
to choose multiple folders to look for new mails. This helps
users to separate their frappe-related email from other
conversations. Use cases range from sieve filters in the
mail server that stuff incoming mail in various mail folders
to people manually sorting their e-mail. In both cases, we
can have different import policies for different folders, and
we can avoid importing unrelated email.

Created a new child table `IMAP Folder` with following fields:
 - Folder Name (user-modifiable)
 - Append To (user-modifiable)
 - UIDVALIDITY (hidden)
 - UIDNEXT (hidden)

Doctype `Email Account` and `receive.py` code adjusted so that
emails with the changes are processed correctly and Frappe
only logs in to the imap server once per sync.

Created a patch that copies the data from the old fields into
the new child table with `INBOX` as default `folder_name`. This
keeps existing setups working without manual changes.

The original fields
 - uidvalidity
 - uidnext
 - append_to
are still available for the pop3 setups. In IMAP, these fields
are hidden user and not used.

Added a test case in `Email Account` that validates data to make
sure a IMAP folder is provided if the use_imap is true.

Also added some code formatting changes in email_account.js to get rid
of sider checks failures that block this change
2021-10-13 10:27:18 +02:00
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
leela
f54600a400 fix: incoming mail handler
While creating a communication record from incoming mail is failing
in a case where there exists a reference document.

reason for bug is misspelled `self.from_email` as `email.from_email`
2021-06-17 07:31:10 +05:30
leela
70a1cfb1ab fix: inbound mail handling for pop3 protocol 2021-06-04 06:55:17 +05:30
Gavin D'souza
8558116c70 Merge branch 'develop' of github.com:frappe/frappe into drop-py2-code 2021-05-31 18:28:28 +05:30
leela
4ce8a600e8 fix: Tests and sider issues 2021-05-31 10:02:13 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
leela
5b96b79ed4 refactor: incoming mails 2021-05-21 18:57:18 +05:30