Skip to content

Commit d42558d

Browse files
committed
Merge pull request dcparker#68 from gabrielengel/master
Allow searching gmail with X-GM-RAW
2 parents 5d8f5b5 + 03fbe82 commit d42558d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/gmail/mailbox.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ def emails(key_or_opts = :all, opts={})
5151
search.concat ['FROM', opts[:from]] if opts[:from]
5252
search.concat ['TO', opts[:to]] if opts[:to]
5353
search.concat ['SUBJECT', opts[:subject]] if opts[:subject]
54+
55+
# Gmail offers us to search the same way we do on the web interface
56+
# https://developers.google.com/gmail/imap_extensions
57+
# example: gmail.emails(gm: 'has:attachment in:unread "who is john galt"')
58+
#
59+
search.concat ['X-GM-RAW', opts[:gm]] if opts[:gm]
5460
end
5561

5662
# puts "Gathering #{(aliases[key] || key).inspect} messages for mailbox '#{name}'..."

0 commit comments

Comments
 (0)