Wählen Sie " Postfach "gesendete Nachrichten" oder "alle Nachrichten" in Ruby Net::IMAP

Ich versuche, Net::IMAP in Ruby Suche alle mail von mir, aber ich hab Probleme mit der Auswahl alles andere als POSTEINGANG.

imap.select('INBOX')

funktioniert gut, aber

imap.select('Mail/sent-mail')

siehe Net::IMAP Dokumentation gibt mir "Unknown Mailbox".

Übrigens, dieser ist mit gmail.

Ich habe auch versucht, den Zusatz "in", "überall" zu meinem imap.search(), aber das hat nicht analysieren.

Aktuelle code:

imap.select('INBOX')
now = Time.now.localtime - 1209600 #two weeks
since = now.day.to_s() + "-" + Date::MONTHNAMES[now.month] + "-" + now.year.to_s()
puts "since"
puts since
begin
  mail_ids = imap.search(["FROM", "me", "SINCE", since])
  mail_ids.each do |id|
    text = imap.fetch(id, 'BODY[HEADER.FIELDS (SUBJECT)]').to_s.split("{").second.chop
    puts text
  end
end
InformationsquelleAutor Eli Albert | 2011-03-03
Schreibe einen Kommentar