Class: Mail::Part

### Home Classes Methods

### In Files

- lib/mail/part.rb

### Parent

Message

### Methods

- #action
- #add_content_id
- #add_required_fields
- #add_required_message_fields
- #bounced?
- #cid
- #delivery_status_data
- #delivery_status_report_part?
- #diagnostic_code
- #error_status
- #final_recipient
- #has_content_id?
- #inline?
- #inline_content_id
- #remote_mta
- #retryable?
- #url

### Files

- TODO.rdoc

### Class/Module Index

Quicksearch

- Mail
- Mail::Address
- Mail::AddressContainer
- Mail::AttachmentsList
- Mail::BccField
- Mail::Body
- Mail::CcField
- Mail::CheckDeliveryParams
- Mail::CommentsField
- Mail::Constants
- Mail::ContentDescriptionField
- Mail::ContentDispositionField
- Mail::ContentIdField
- Mail::ContentLocationField
- Mail::ContentTransferEncodingElement
- Mail::ContentTransferEncodingField
- Mail::ContentTypeField
- Mail::DateField
- Mail::Encodings
- Mail::Encodings::Base64
- Mail::Encodings::Binary
- Mail::Encodings::EightBit
- Mail::Encodings::QuotedPrintable
- Mail::Encodings::SevenBit
- Mail::Encodings::TransferEncoding
- Mail::Encodings::UnixToUnix
- Mail::Envelope
- Mail::EnvelopeFromElement
- Mail::Exim
- Mail::Field
- Mail::Field::FieldError
- Mail::FieldList
- Mail::FileDelivery
- Mail::FromField
- Mail::Header
- Mail::IMAP
- Mail::InReplyToField
- Mail::IndifferentHash
- Mail::KeywordsField
- Mail::Matchers
- Mail::Matchers::HasSentEmailMatcher
- Mail::MessageIdField
- Mail::MessageIdsElement
- Mail::MimeVersionElement
- Mail::MimeVersionField
- Mail::Multibyte
- Mail::Multibyte::EncodingError
- Mail::OptionalField
- Mail::POP3
- Mail::ParameterHash
- Mail::Parsers
- Mail::Parsers::AddressListsParser
- Mail::Parsers::ContentDispositionParser
- Mail::Parsers::ContentLocationParser
- Mail::Parsers::ContentTransferEncodingParser
- Mail::Parsers::ContentTypeParser
- Mail::Parsers::DateTimeParser
- Mail::Parsers::EnvelopeFromParser
- Mail::Parsers::MessageIdsParser
- Mail::Parsers::MimeVersionParser
- Mail::Parsers::PhraseListsParser
- Mail::Parsers::Ragel
- Mail::Parsers::Ragel::AddressListsMachine
- Mail::Parsers::Ragel::ContentDispositionMachine
- Mail::Parsers::Ragel::ContentLocationMachine
- Mail::Parsers::Ragel::ContentTransferEncodingMachine
- Mail::Parsers::Ragel::ContentTypeMachine
- Mail::Parsers::Ragel::DateTimeMachine
- Mail::Parsers::Ragel::EnvelopeFromMachine
- Mail::Parsers::Ragel::MessageIdsMachine
- Mail::Parsers::Ragel::MimeVersionMachine
- Mail::Parsers::Ragel::PhraseListsMachine
- Mail::Parsers::Ragel::ReceivedMachine
- Mail::Parsers::Ragel::Ruby
- Mail::Parsers::ReceivedParser
- Mail::Part
- Mail::PartsList
- Mail::PhraseList
- Mail::ReceivedElement
- Mail::ReceivedField
- Mail::ReferencesField
- Mail::ReplyToField
- Mail::ResentBccField
- Mail::ResentCcField
- Mail::ResentDateField
- Mail::ResentFromField
- Mail::ResentMessageIdField
- Mail::ResentSenderField
- Mail::ResentToField
- Mail::Retriever
- Mail::ReturnPathField
- Mail::Ruby18
- Mail::Ruby19
- Mail::Ruby19::BestEffortCharsetEncoder
- Mail::Ruby19::StrictCharsetEncoder
- Mail::SMTP
- Mail::SMTPConnection
- Mail::SenderField
- Mail::Sendmail
- Mail::StructuredField
- Mail::SubjectField
- Mail::TestMailer
- Mail::TestRetriever
- Mail::ToField
- Mail::UnstructuredField
- Mail::Utilities
- Mail::VERSION
- Net
- Net::SMTP
- Object
- String

No matching classes.

# Mail::Part

### Public Instance Methods

action() click to toggle source

Either returns the action if the message has just a single report, or an array of all the actions, one for each report

    # File lib/mail/part.rb, line 67
    def action
      get_return_values('action')
    end

add_content_id(content_id_val = '') click to toggle source

Creates a new empty Content-ID field and inserts it in the correct order into the Header. The ContentIdField object will automatically generate a unique content ID if you try and encode it or output it to_s without specifying a content id.

It will preserve the content ID you specify if you do.

    # File lib/mail/part.rb, line 10
    def add_content_id(content_id_val = '')
      header['content-id'] = content_id_val
    end

add_required_fields() click to toggle source

    # File lib/mail/part.rb, line 39
    def add_required_fields
      super
      add_content_id if !has_content_id? && inline?
    end

add_required_message_fields() click to toggle source

    # File lib/mail/part.rb, line 44
    def add_required_message_fields
      # Override so we don't add Date, MIME-Version, or Message-ID.
    end

bounced?() click to toggle source

    # File lib/mail/part.rb, line 56
    def bounced?
      if action.is_a?(Array)
        !!(action.first =~ /failed/)
      else
        !!(action =~ /failed/)
      end
    end

cid() click to toggle source

    # File lib/mail/part.rb, line 26
    def cid
      add_content_id unless has_content_id?
      uri_escape(unbracket(content_id))
    end

delivery_status_data() click to toggle source

    # File lib/mail/part.rb, line 52
    def delivery_status_data
      delivery_status_report_part? ? parse_delivery_status_report : {}
    end

delivery_status_report_part?() click to toggle source

    # File lib/mail/part.rb, line 48
    def delivery_status_report_part?
      (main_type =~ /message/ && sub_type =~ /delivery-status/) && body =~ /Status:/
    end

diagnostic_code() click to toggle source

    # File lib/mail/part.rb, line 79
    def diagnostic_code
      get_return_values('diagnostic-code')
    end

error_status() click to toggle source

    # File lib/mail/part.rb, line 75
    def error_status
      get_return_values('status')
    end

final_recipient() click to toggle source

    # File lib/mail/part.rb, line 71
    def final_recipient
      get_return_values('final-recipient')
    end

has_content_id?() click to toggle source

Returns true if the part has a content ID field, the field may or may not have a value, but the field exists or not.

    # File lib/mail/part.rb, line 16
    def has_content_id?
      header.has_content_id?
    end

inline?() click to toggle source

    # File lib/mail/part.rb, line 35
    def inline?
      header[:content_disposition].disposition_type == 'inline' if header[:content_disposition]
    end

inline_content_id() click to toggle source

    # File lib/mail/part.rb, line 20
    def inline_content_id
      # TODO: Deprecated in 2.2.2 - Remove in 2.3
      STDERR.puts("Part#inline_content_id is deprecated, please call Part#cid instead")
      cid
    end

remote_mta() click to toggle source

    # File lib/mail/part.rb, line 83
    def remote_mta
      get_return_values('remote-mta')
    end

retryable?() click to toggle source

    # File lib/mail/part.rb, line 87
    def retryable?
      !(error_status =~ /^5/)
    end

url() click to toggle source

    # File lib/mail/part.rb, line 31
    def url
      "cid:#{cid}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.