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 64
64: def action
65: get_return_values('action')
66: end
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 11
11: def add_content_id(content_id_val = '')
12: header['content-id'] = content_id_val
13: end
# File lib/mail/part.rb, line 40
40: def add_required_fields
41: add_content_id unless has_content_id?
42: super
43: end
# File lib/mail/part.rb, line 53
53: def bounced?
54: if action.is_a?(Array)
55: !!(action.first =~ /failed/)
56: else
57: !!(action =~ /failed/)
58: end
59: end
# File lib/mail/part.rb, line 27
27: def cid
28: add_content_id unless has_content_id?
29: uri_escape(unbracket(content_id))
30: end
# File lib/mail/part.rb, line 49
49: def delivery_status_data
50: delivery_status_report_part? ? parse_delivery_status_report : {}
51: end
# File lib/mail/part.rb, line 45
45: def delivery_status_report_part?
46: (main_type =~ /message/ && sub_type =~ /delivery-status/) && body =~ /Status:/
47: end
# File lib/mail/part.rb, line 76
76: def diagnostic_code
77: get_return_values('diagnostic-code')
78: end
# File lib/mail/part.rb, line 72
72: def error_status
73: get_return_values('status')
74: end
# File lib/mail/part.rb, line 68
68: def final_recipient
69: get_return_values('final-recipient')
70: end
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 17
17: def has_content_id?
18: header.has_content_id?
19: end
# File lib/mail/part.rb, line 36
36: def inline?
37: header[:content_disposition].disposition_type == 'inline' if header[:content_disposition]
38: end
# File lib/mail/part.rb, line 21
21: def inline_content_id
22: # TODO: Deprecated in 2.2.2 - Remove in 2.3
23: STDERR.puts("Part#inline_content_id is deprecated, please call Part#cid instead")
24: cid
25: end
# File lib/mail/part.rb, line 80
80: def remote_mta
81: get_return_values('remote-mta')
82: end
# File lib/mail/part.rb, line 90
90: def get_return_values(key)
91: if delivery_status_data[key].is_a?(Array)
92: delivery_status_data[key].map { |a| a.value }
93: else
94: delivery_status_data[key].value
95: end
96: end
# File lib/mail/part.rb, line 110
110: def parse_delivery_status_report
111: @delivery_status_data ||= Header.new(body.to_s.gsub("\r\n\r\n", "\r\n"))
112: end
A part may not have a header.... so, just init a body if no header
# File lib/mail/part.rb, line 99
99: def parse_message
100: header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/, 2)
101: if header_part =~ HEADER_LINE
102: self.header = header_part
103: self.body = body_part
104: else
105: self.header = "Content-Type: text/plain\r\n"
106: self.body = header_part
107: end
108: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.