Class: Email::Cleaner
- Inherits:
-
Object
- Object
- Email::Cleaner
- Defined in:
- lib/email/cleaner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(mail, remove_attachments: true, truncate: true, rejected: false) ⇒ Cleaner
constructor
A new instance of Cleaner.
Constructor Details
#initialize(mail, remove_attachments: true, truncate: true, rejected: false) ⇒ Cleaner
Returns a new instance of Cleaner.
5 6 7 8 9 10 11 |
# File 'lib/email/cleaner.rb', line 5 def initialize(mail, remove_attachments: true, truncate: true, rejected: false) @mail = Mail.new(mail) @mail.charset = "UTF-8" @remove_attachments = @truncate = truncate @rejected = rejected end |
Class Method Details
.delete_rejected! ⇒ Object
19 20 21 22 23 24 |
# File 'lib/email/cleaner.rb', line 19 def self.delete_rejected! IncomingEmail.delete_by( "rejection_message IS NOT NULL AND created_at < ?", SiteSetting.delete_rejected_email_after_days.days.ago, ) end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 |
# File 'lib/email/cleaner.rb', line 13 def execute @mail. if @remove_attachments truncate! if @truncate remove_null_byte(@mail.to_s) end |