class GmailUtilities

Public Class Methods

readLatestMailFromGmail(username,password,sender) click to toggle source
# File lib/gmailUtilities.rb, line 4
def self.readLatestMailFromGmail(username,password,sender)
  gmail = Gmail.connect(username, password)
  numberOfEmails=gmail.inbox.emails(:from => sender).length
  mail=gmail.inbox.emails(:from => sender)[numberOfEmails-1]
  linkInTheEmail=mail.html_part.decoded.scan(/<a.+?href="(.+?)".+?/)[0]
  return linkInTheEmail
end