Sha256: 481471bd82db5f0dbf9a0630437d94114168005ca5f32b0cbc7f87651526c4f5

Contents?: true

Size: 1017 Bytes

Versions: 1

Compression:

Stored size: 1017 Bytes

Contents

class Net::IMAP::Envelope
  CRLF = "\r\n"
  HEDCNS = [
    ['Date:', ->(s){ s.date } ],
    ['Subject:', ->(s){ s.subject } ],
    ['Date:', ->(s){ s.date } ],
    ['Message-ID:', ->(s){ s.message_id }],
    ['Sender:', ->(s){
       s.sender.map{ |f|
         "#{f.name} <#{f.mailbox}@#{f.host}>"
       }.join ',' unless s.sender.nil? } ],
    ['From:', ->(s){
       s.from.map{ |f|
         "#{f.name} <#{f.mailbox}@#{f.host}>"
       }.join ',' unless s.from.nil? } ],
    ['To:', ->(s){
       s.to.map{ |f|
         "#{f.name} <#{f.mailbox}@#{f.host}>"
       }.join ',' unless s.to.nil? } ],
    ['Cc:', ->(s){
       s.cc.map{ |f|
         "#{f.name} <#{f.mailbox}@#{f.host}>"
       }.join ',' unless s.cc.nil? } ],
    ['Bcc:', ->(s){
       s.bcc.map{ |f|
         "#{f.name} <#{f.mailbox}@#{f.host}>"
       }.join ',' unless s.bcc.nil? } ],
    ['In-Reply-To:', ->(s){ s.in_reply_to }],
  ].to_h
  
  def email_header
    HEDCNS.map{ |field, fun| "#{field} #{fun.(self)}" }
      .join CRLF
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imap-filter-0.0.2 lib/imap-filter/monkeypatches.rb