File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ module Mail
3
3
class IMAP
4
4
attr_accessor :imap_connection
5
5
6
+ # fetch emails with different flag, to make it work with icloud
7
+ FETCH_EMAIL_FLAG = "BODY[]" #"RFC822"
8
+
6
9
def find_emails ( options = { } , &block ) # rubocop:disable all
7
10
options = validate_options ( options )
8
11
options [ :read_only ] ? imap_connection . examine ( options [ :mailbox ] ) : imap_connection . select ( options [ :mailbox ] )
@@ -36,8 +39,8 @@ def find_emails(options = {}, &block) # rubocop:disable all
36
39
37
40
uids . each do |uid |
38
41
uid = options [ :uid ] . to_i unless options [ :uid ] . nil?
39
- fetchdata = imap_connection . uid_fetch ( uid , [ 'RFC822' ] ) [ 0 ]
40
- emails << Mail . new ( fetchdata . attr [ 'RFC822' ] )
42
+ fetchdata = imap_connection . uid_fetch ( uid , [ FETCH_EMAIL_FLAG ] ) [ 0 ]
43
+ emails << Mail . new ( fetchdata . attr [ FETCH_EMAIL_FLAG ] )
41
44
imap_connection . uid_store ( uid , '+FLAGS' , [ Net ::IMAP ::DELETED ] ) if options [ :delete_after_find ]
42
45
break unless options [ :uid ] . nil?
43
46
end
Original file line number Diff line number Diff line change 1
1
module MailHandler
2
- VERSION = '1.0.39 ' . freeze
2
+ VERSION = '1.0.40 ' . freeze
3
3
end
You can’t perform that action at this time.
0 commit comments