def mailbox(name, delim = '/')
retries = 0
name.gsub!(/^(inbox\/?)/i){ $1.upcase }
name.gsub!(delim, self.delim)
name.strip! if @quirks[:gmail]
begin
@mailboxes.fetch(name) do
update_mailboxes
return @mailboxes[name] if @mailboxes.has_key?(name)
raise MailboxNotFoundError, "mailbox not found: #{name}"
end
rescue MailboxNotFoundError => e
raise unless @options[:create_mailbox] && retries == 0
info "creating mailbox: #{name}"
safely { @conn.create(Net::IMAP.encode_utf7(name)) } unless @options[:dry_run]
retries += 1
retry
end
end