Wrong format in to_imap_date method
nimdraugsael opened this issue · 4 comments
nimdraugsael commented
Yesterday I started getting Net::IMAP::BadResponseError: Could not parse command
when used before and after params for inbox.
Date format in IMAP spec
https://tools.ietf.org/html/rfc3501 page 83
date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
"Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
So, it should be
class Object
def to_imap_date
Date.parse(to_s).strftime("%d-%b-%Y")
end
end
in https://github.com/dcparker/ruby-gmail/blob/master/lib/gmail/mailbox.rb#L5
richardrails commented
+1
rickumali commented
I have a script that uses ruby-gmail that runs every month. Last month (Sept 2016) it worked, this month (Oct 2016), it spit out:
$HOME/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/net/imap.rb:1158:in `get_tagged_response':
Could not parse command (Net::IMAP::BadResponseError)
from $HOME/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/net/imap.rb:1210:in
`block in send_command'
My script uses the before and after params to gmail.inbox.emails().each.
I applied the one character patch from @nimdraugsael and now the script works again!
nimdraugsael commented
Hey, any maintainers here? :)
jasonjei commented
@nimdraugsael The maintainer had passed away a few years ago...