Skip to content

Commit 5490807

Browse files
committed
change email search flag for fetching
1 parent 048860a commit 5490807

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/mailhandler/receiving/mail.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ module Mail
33
class IMAP
44
attr_accessor :imap_connection
55

6+
# fetch emails with different flag, to make it work with icloud
7+
FETCH_EMAIL_FLAG = "BODY[]" #"RFC822"
8+
69
def find_emails(options = {}, &block) # rubocop:disable all
710
options = validate_options(options)
811
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
3639

3740
uids.each do |uid|
3841
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])
4144
imap_connection.uid_store(uid, '+FLAGS', [Net::IMAP::DELETED]) if options[:delete_after_find]
4245
break unless options[:uid].nil?
4346
end

lib/mailhandler/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module MailHandler
2-
VERSION = '1.0.39'.freeze
2+
VERSION = '1.0.40'.freeze
33
end

0 commit comments

Comments
 (0)