Re: need to advice: about gmail trash empty

[email protected] (Byung-Hee HWANG (황병희, 黃 炳熙))
Newsgroups gmane.comp.lang.ruby.general
Message-ID <[email protected]>
[email protected] (Byung-Hee HWANG "(황병희, 黃炳熙)") writes:

> [...snip...]
> my mailbox is Google Apps (Gmail). it is now full (almost 98%). most
> messages are trash folder. just i did try to remove all trash messages
> permantly on the web. but web browser was freeze. so i thank a
> while. yes i have to ruby script!!! i like ruby but just i am newbie
> level. so please advise any comments about empty trash gmail with
> ruby. currently i use ruby 2.5 on ubuntu 18.04, hardware is chromebook [arm64].

just i installed ruby gem 'gmail' by `sudo gem install gmail'. install is
success. then i wrote as code:

#+BEGIN_SRC ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

require 'gmail'

gmail = Gmail.connect('MY_GMAIL_ID', 'MY_GMAIL_PASSWORD')

gmail.mailbox('[Gmail]/Trash').emails.each do |email|
  email.delete!
end

gmail.connection.expunge
gmail.logout
#+END_SRC

but i did failed. see as belows: (error messages)

#+BEGIN_SRC txt
(bionic)soyeomul@localhost:~/work$ ./1.rb
Traceback (most recent call last):
	11: from ./1.rb:10:in `<main>'
	10: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:159:in `mailbox'
	 9: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:159:in `synchronize'
	 8: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:162:in `block in mailbox'
	 7: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:222:in `switch_to_mailbox'
	 6: from /usr/lib/ruby/2.5.0/net/imap.rb:457:in `select'
	 5: from /usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
	 4: from /usr/lib/ruby/2.5.0/net/imap.rb:459:in `block in select'
	 3: from /usr/lib/ruby/2.5.0/net/imap.rb:1253:in `send_command'
	 2: from /usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
	 1: from /usr/lib/ruby/2.5.0/net/imap.rb:1271:in `block in send_command'
/usr/lib/ruby/2.5.0/net/imap.rb:1217:in `get_tagged_response':  Unknown Mailbox: [Gmail]/Trash (Failure) (Net::IMAP::NoResponseError)
(bionic)soyeomul@localhost:~/work$ 
#+END_SRC

thanks in advance,,,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//


Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.