EM.run do
delegate = EM::IMAP.new('imap.gmail.com',993,true)
delegate.connect.bind! do
delegate.login('myemail@gmail.com', 'password')
end.bind! do
delegate.select('INBOX')
end.bind! do
delegate.search(["SINCE", Time.now.strftime('%d-%b-%y')])
end.bind! do |ids|
delegate.fetch(ids, "(UID RFC822)")
end.callback do |raw_messages|
puts raw_messages
end.errback do |error|
puts "Connecting or logging in failed: #{error}"
end
end
I try something very basic:
And this line fails right here:
delegate.search(["SINCE", Time.now.strftime('%d-%b-%y')])
with error: Could not parse command
However, if I switch it to:
delegate.search( ['1:2'])
Then it works. That is the only search option that appears to work. Everything else says 'Could not parse command'. Anyone know why this happens?