class Mail::MessageIdField - mail-2.5.4 Documentation

# class Mail::MessageIdField

### Constants

CAPITALIZED_FIELD
FIELD_NAME

### Public Class Methods

new(value = nil, charset = 'utf-8') click to toggle source
Calls superclass method

    # File lib/mail/fields/message_id_field.rb, line 40
    def initialize(value = nil, charset = 'utf-8')
      self.charset = charset
      @uniq = 1
      if value.blank?
        self.name = CAPITALIZED_FIELD
        self.value = generate_message_id
      else
        super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
      end
      self.parse
      self

    end

### Public Instance Methods

decoded() click to toggle source

    # File lib/mail/fields/message_id_field.rb, line 70
    def decoded
      do_decode
    end

encoded() click to toggle source

    # File lib/mail/fields/message_id_field.rb, line 66
    def encoded
      do_encode(CAPITALIZED_FIELD)
    end

message_ids() click to toggle source

    # File lib/mail/fields/message_id_field.rb, line 58
    def message_ids
      [message_id]
    end

name() click to toggle source

    # File lib/mail/fields/message_id_field.rb, line 54
    def name
      'Message-ID'
    end

to_s() click to toggle source

    # File lib/mail/fields/message_id_field.rb, line 62
    def to_s
      "<#{message_id}>"
    end

### Private Instance Methods

generate_message_id() click to toggle source

    # File lib/mail/fields/message_id_field.rb, line 76
    def generate_message_id
      "<#{Mail.random_tag}@#{::Socket.gethostname}.mail>"
    end