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
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.
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`
* 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
chardet requires input to be bytes or bytesarray, but sometimes
frappe.cstr() returns text_type of str without encoding it to utf-8
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
fixes issues with class objects other than str
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 281, in receive
communication = self.insert_communication(msg, args=args)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 338, in insert_communication
email = Email(raw)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 372, in __init__
self.parse()
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 393, in parse
self.process_part(part)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 445, in process_part
self.text_content += self.get_payload(part)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 489, in get_payload
charset = self.get_charset(part)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 484, in get_charset
charset = chardet.detect(frappe.safe_encode(part))['encoding']
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/chardet/__init__.py", line 34, in detect
'{0}'.format(type(byte_str)))
TypeError: Expected object of type bytes or bytearray, got: <class 'email.message.Message'>
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
+existing code, works fine in python 2.7
+in python 3 it breaks
+In python 3 there is change in chardet module and hence the error
+convert-string-to-bytes-in-python-3
+this is also fixed in v11-hotfix branch
* [email] remove style from email so it does not mess up desk
* [fix] tests
* [fix] image parsing, #savedbyatestcase
* [fix] timeout issues in test
* [fix] timeout issues in test