# Support for IMAP IDLE in net/imap

**URL:** <https://www.ruby-forum.com/t/support-for-imap-idle-in-net-imap/171481>\
**Category:** Ruby\
**Created:** [July 3, 2009, 10:18am UTC](https://www.ruby-forum.com/t/support-for-imap-idle-in-net-imap/171481 "2009-07-03T10:18:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@abhishiv](https://www.ruby-forum.com/u/abhishiv)\
**Post date:** [July 3, 2009, 10:18am UTC](https://www.ruby-forum.com/t/support-for-imap-idle-in-net-imap/171481/1 "2009-07-03T10:18:36Z")

</div>

Ok, I have been stuck on it for hours. I thought net/imap.rb with ruby  
1.9 supported the idle command, but not yet.

Can anyone help me in implementing that? From here, I though this would  
work:

class Net::IMAP  
def idle

```
cmd = "IDLE"
synchronize do
  tag = generate_tag

  put_string(tag + " " + cmd)

  put_string(CRLF)
end

```

end

def done  
cmd = “DONE”

```
synchronize do
  put_string(cmd)
  put_string(CRLF)

end

```

end  
end

But, when i issue imap.idle, it return true, but i have to press return  
twice to get the server response. And there’s no notification for new  
messages.

?\> imap.idle  
C: RUBY0005 IDLE  
=\> true

> >

?\>  
?\> S: + idling
