require 'rubygems' require 'rbosa' require 'tmail' require 'net/pop' opts = {:username => '[ur pop box]', :password => '[ur pw!]', :server => '[ur server]'} pop = Net::POP3.new(opts[:server]) pop.start(opts[:username], opts[:password]) things = OSA.app('Things') inbox = things.lists.collect {|i| i if i.name.match /Inbox/ }.delete_if {|i| i.nil? }.first def remove_sig (str) if str.match /--\n/ str.split("-- ").first else str end end if pop.mails.empty? exit else pop.each_mail do |mail| message = TMail::Mail.parse(mail.pop()) message_body = remove_sig(message.body) todo = Hash.new if message.subject.size != 0 todo[:name] = message.subject.strip if message_body.strip.size != 0 todo[:note] = message_body.strip end elsif message_body.strip.size != 0 todo[:name] = message_body.strip end things.make(OSA::Things::ToDo, inbox, todo) mail.delete end end