Commit graph

102 commits

Author SHA1 Message Date
Chinmay D. Pai
4d48a2a032
fix(email): handle case where cstr returns text_type of str
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>
2019-12-27 16:28:09 +05:30
Chinmay Pai
d169f41a54 fix(email): try to encode email part to utf-8 (#8965)
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>
2019-12-09 19:25:43 +05:30
Faris Ansari
488c68df96
Merge branch 'develop' into refactor-scheduler 2019-12-02 13:16:45 +05:30
Rushabh Mehta
7cd329fac9 reactor(scheduler): created "Scheduler Job Type" and cleaned up scheduler 2019-11-07 12:14:09 +05:30
Rucha Mahabal
ac41e46ed6 fix(Email): poplib.error_proto exception 2019-10-13 20:48:54 +05:30
Saurabh
c64dece0dd feat: allow custom imap port (#8305)
* feat: allow custom imap port

* fix: use default port if not specified

* fix: pop3 port

* fix: common code to set the incomming port

* fix: codacy
2019-09-25 23:04:05 +00:00
Suraj Shetty
3eb6a22989
fix: Remove unwanted str() 2019-08-21 13:28:14 +05:30
Ashish Shah
4c7cbd6d7a
Update receive.py 2019-08-21 12:01:06 +05:30
Ashish Shah
b8803a51ad
Update receive.py 2019-08-19 18:34:52 +05:30
Ashish Shah
921788474e
Update receive.py
+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
2019-07-31 10:17:19 +05:30
Saurabh
6d9fa54f0b Merge branch 'master' into develop 2019-03-20 14:30:48 +05:30
Aleksas Pielikis
70ac6f5c4e fix(email): Fixed py3 email byte-content decoding (#7058)
* Email decode from bytes fix added.

* Correction according to comments.
2019-03-18 13:08:06 +05:30
Sagar Vora
56a221573b Merge branch 'master' into develop 2019-02-19 17:52:19 +05:30
Rushabh Mehta
572edb08ba fix(email): default UIDVALIDITY to 0 2019-02-19 14:28:14 +05:30
Saurabh
d1bed88f3f Merge branch 'staging' into develop 2019-01-15 19:14:06 +05:30
Rohit Waghchaure
59549eb9df [Fix] Emails are not fetching 2019-01-10 16:01:36 +05:30
Chinmay Pai
75c7992557
file-api: add new test, fix minor bugs and code indentation
Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-21 13:40:25 +05:30
Chinmay Pai
91aff48a19
file-api: fix email test and improve file saving logic
Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-20 15:40:04 +05:30
Chinmay Pai
5bd66f134d
file-api: add improvements to save() api
file can now be saved by calling save() on the file object instance

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-13 09:46:48 +05:30
Chinmay Pai
6eca292e1a
[3/3] file-api: code migration
migrate api from file_manager.py to file.py

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-06 01:18:21 +05:30
Chinmay Pai
22ba310aaf
[2/3] file-api: code migration
migrate api from file_manager.py to file.py

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-03 18:04:45 +05:30
Chinmay Pai
16a99f5472
[1/3] file-api: code migration
migrate api from file_manager.py to file.py

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-08-31 01:55:15 +05:30
Benji
aee86f7bc0 python3 minor bugfix (#5988)
* Update receive.py

* Update receive.py

* Update receive.py
2018-08-22 11:01:03 +05:30
Benji
0330499bb9 Fixes error (#5902)
Fixes "TypeError: cannot use a string pattern on a bytes-like object"
2018-08-07 14:44:40 +05:30
Rushabh Mehta
aef1046b1f
[email] remove style from email so it does not mess up desk (#5860)
* [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
2018-07-24 17:00:14 +05:30
Rushabh Mehta
8488acf300
[fix] receive.py (#5369) 2018-04-05 16:35:43 +05:30
Achilles Rasquinha
bc702c6c00 bytes vs strings 2018-03-08 20:17:18 +05:30
Achilles Rasquinha
d62c586fb2 [FIX] fix sytntax 2018-03-08 18:12:19 +05:30
Achilles Rasquinha
4b2e182915 [FIX] safe_encode 2018-03-08 18:09:57 +05:30
Achilles Rasquinha
59d3986290 [FIX] safe decode for 3 2018-03-08 17:25:27 +05:30
Achilles Rasquinha
d1e38d21c2 [FIX] safe decode for 3 2018-03-08 17:18:38 +05:30
Achilles Rasquinha
93a3921f1d [FIX] safe decode for 3 2018-03-08 17:11:52 +05:30
Achilles Rasquinha
97963119a5 email parse content to unicode 2018-03-08 16:35:02 +05:30
Aditya Hase
e6bd1e4995 Replaced all instances of 'unicode' with 'six.text_type' (#3825) 2017-08-02 16:57:39 +05:30
tundebabzy
bbde2ec4cf rewrite use of dict.iteritems (#3498)
* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility

* dict.iteritems to six.iteritems(dict) for python3 compatibility
2017-06-19 09:10:21 +05:30
Makarand Bauskar
71d1e8c0e0 [minor] select the Inbox in readonly false mode while pulling emails (#3412) 2017-06-02 14:03:21 +05:30
Ayush Shukla
7ff1985257 Email praseaddr fix, fixes frappe/issues#3004 (#3345)
* email_parse address fix

* travis check for email-parseaddr

* email parseaddr fix

* fixes

* Added test case

* minor change

* Added few email_ids

* condition change
2017-05-19 15:50:21 +05:30
tundebabzy
c8d8baeaff fixes frappe/erpnext#8606 (#3322)
* fixes frappe/erpnext#8606

* fixes frappe/erpnext#8606
2017-05-18 12:06:52 +05:30
Nabin Hait
d294d158f5 Update receive.py 2017-05-11 15:12:14 +05:30
tundebabzy
6e29d9e925 xrange to range (#3237)
* introduces build status for local fork

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range

* converts xrange to range using six.moves.range

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* Revert "introduces build status for local fork"

This reverts commit 61f40983d0b3c6725369171ab850a18e5c029cc4.
2017-05-11 10:55:34 +05:30
tundebabzy
6fbe20caaa Except and raise statement python 3 compatible style (#3216)
* changes exception and raise statements to python 3 style

* changes except statement to python 3 style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* changes except and raise statement to python 3 compatible style

* adds six.reraise to fix python 3 style raise statements with traceback

* fixes indentation
2017-05-11 10:51:59 +05:30
ci2014
99f6a34b18 Set readonly of selected Inbox to False (#3258)
Mails are not marked as SEEN, when the readonly parameter is True. That's a problem since tickets are being refreshed all few minutes, and, if you have more than 50 unread mails in your inbox, most of them will never be imported to Frappe / ERPNext.
2017-05-10 17:51:49 +05:30
Makarand Bauskar
7febef2e62 [fix][hot] email pull fixes (#3191) 2017-04-29 16:01:23 +05:30
Rushabh Mehta
72117dd5d3 [fix] email fixes from failed scheduler logs 2017-04-28 14:40:18 +05:30
Rushabh Mehta
a7f63eb381 [minor] fixes for frappe/erpnext#8347 2017-04-14 16:10:53 +05:30
robert schouten
79620ab716 remove quotes from from header for unicode parse (#2888) 2017-03-24 15:49:26 +05:30
mbauskar
9bfc32cb7a [minor] fixes in email read / unread flags 2017-03-15 13:20:29 +05:30
mbauskar
10868dfe0c [fixes] removed the fingerprint and used the message-id to check email duplications 2017-03-08 16:44:00 +05:30
Nabin Hait
ad4a334561 Merge pull request #2827 from RobertSchouten/remove_attachment_newlines_dev
[fix] remove newlines from email attachments as cannot be handled
2017-03-08 14:18:33 +05:30
Nabin Hait
622c244ce5 Merge pull request #2697 from mbauskar/imap
[enhancement] IMAP mail syncing
2017-03-08 14:14:55 +05:30