Skip to content

Instantly share code, notes, and snippets.

@yoshuki
Created March 8, 2016 06:41
Show Gist options
  • Save yoshuki/269c824e24b4c53357df to your computer and use it in GitHub Desktop.
Save yoshuki/269c824e24b4c53357df to your computer and use it in GitHub Desktop.
require 'net/imap'
HOST = ''
USER = ''
PASSWORD = ''
imap = Net::IMAP.new(HOST, 993, true)
imap.authenticate('LOGIN', USER, PASSWORD)
imap.select('INBOX')
imap.search(['UNSEEN']).each do |message_id|
puts message_id
imap.store(message_id, '+FLAGS', [:Seen])
end
imap.close
imap.logout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment