Skip to content
Newer
Older
100644 31 lines (27 sloc) 1.08 KB
7907f05 @PrasannaVenkadesh Version 2.50
authored
1 class Check
2
3 require 'rubygems'
4 require 'gmail'
5
6 def do_check(uname,pwd)
7 username = uname
8 password = pwd
9
10 Gmail.connect(username, password) do |gmail|
11 puts "Enter today's date in format YYYY-MM-DD: "
12 today = gets.chomp
13 system('clear')
14 puts "1. You have "+ gmail.inbox.count(:unread).to_s + " unread mails"
15 puts "2. You have "+ gmail.inbox.count(:unread, :on => Date.parse(today)).to_s+ " unread mails today"
16 puts "\nDo you want to perform more operations? (y/n)? "
17 more = gets.chomp
18 if(more == 'y')
19 puts "Check Subject of mail from a specific user on a specific date\nEnter user's mail id: "
20 user_mail_id=gets.chomp
21 puts "Enter a specific date in the format YYYY-MM-DD: "
22 date = gets.chomp
23 gmail.inbox.emails(:from=> user_mail_id, :on => Date.parse(date)).each do |email|
24 puts email.subject
25 end
26 end
27 gmail.logout
28 end
29 end
30 end
Something went wrong with that request. Please try again.