Module: OnlyofficeIredmailHelper::DeleteMethods
- Included in:
- IredMailHelper
- Defined in:
- lib/onlyoffice_iredmail_helper/delete_methods.rb
Overview
Methods to delete messages
Instance Method Summary collapse
-
#delete_all_messages ⇒ nil
Delete all messages in inbox.
-
#delete_email_by_subject(subject) ⇒ nil
Delete email by subject.
Instance Method Details
#delete_all_messages ⇒ nil
Delete all messages in inbox
8 9 10 11 12 13 14 |
# File 'lib/onlyoffice_iredmail_helper/delete_methods.rb', line 8 def login @imap.select('INBOX') @imap.store(@imap.search(['ALL']), '+FLAGS', [:Deleted]) unless @imap.search(['ALL']).empty? OnlyofficeLoggerHelper.log('Delete all messages') close end |
#delete_email_by_subject(subject) ⇒ nil
Delete email by subject
19 20 21 22 23 24 25 |
# File 'lib/onlyoffice_iredmail_helper/delete_methods.rb', line 19 def delete_email_by_subject(subject) login @imap.select('INBOX') id_emails = @imap.search(['SUBJECT', subject.dup.force_encoding('ascii-8bit')]) @imap.store(id_emails, '+FLAGS', [:Deleted]) unless id_emails.empty? close end |