Class: Mail::Part
Constant Summary
Constants included
from Patterns
Mail::Patterns::ATOM_UNSAFE, Mail::Patterns::CONTROL_CHAR, Mail::Patterns::CRLF, Mail::Patterns::FIELD_BODY, Mail::Patterns::FIELD_LINE, Mail::Patterns::FIELD_NAME, Mail::Patterns::FWS, Mail::Patterns::HEADER_LINE, Mail::Patterns::PHRASE_UNSAFE, Mail::Patterns::QP_SAFE, Mail::Patterns::QP_UNSAFE, Mail::Patterns::TEXT, Mail::Patterns::TOKEN_UNSAFE, Mail::Patterns::WSP
Instance Attribute Summary
Attributes inherited from Message
#delivery_handler, #perform_deliveries, #raise_delivery_errors
Instance Method Summary
collapse
Methods inherited from Message
#<=>, #==, #[], #[]=, #add_charset, #add_content_transfer_encoding, #add_content_type, #add_date, #add_file, #add_message_id, #add_mime_version, #add_part, #add_transfer_encoding, #all_parts, #attachment, #attachment?, #attachments, #bcc, #bcc=, #bcc_addrs, #body, #body=, #body_encoding, #body_encoding=, #boundary, #cc, #cc=, #cc_addrs, #charset, #charset=, #comments, #comments=, #content_description, #content_description=, #content_disposition, #content_disposition=, #content_id, #content_id=, #content_location, #content_location=, #content_transfer_encoding, #content_transfer_encoding=, #content_type, #content_type=, #content_type_parameters, #convert_to_multipart, #date, #date=, #decode_body, #decoded, #default, #deliver, #deliver!, #delivery_method, #delivery_status_part, #delivery_status_report?, #destinations, #encode!, #encoded, #envelope_date, #envelope_from, #errors, #filename, #find_first_mime_type, #from, #from=, #from_addrs, #has_attachments?, #has_charset?, #has_content_transfer_encoding?, #has_content_type?, #has_date?, #has_message_id?, #has_mime_version?, #has_transfer_encoding?, #header, #header=, #header_fields, #headers, #html_part, #html_part=, #in_reply_to, #in_reply_to=, #inform_interceptors, #inform_observers, #initialize, #inspect, #is_marked_for_delete?, #keywords, #keywords=, #main_type, #mark_for_delete=, #message_content_type, #message_id, #message_id=, #method_missing, #mime_parameters, #mime_type, #mime_version, #mime_version=, #multipart?, #multipart_report?, #part, #parts, #raw_envelope, #raw_source, #read, #ready_to_send!, #received, #received=, #references, #references=, #register_for_delivery_notification, #reply, #reply_to, #reply_to=, #resent_bcc, #resent_bcc=, #resent_cc, #resent_cc=, #resent_date, #resent_date=, #resent_from, #resent_from=, #resent_message_id, #resent_message_id=, #resent_sender, #resent_sender=, #resent_to, #resent_to=, #return_path, #return_path=, #sender, #sender=, #set_envelope, #skip_deletion, #sub_type, #subject, #subject=, #text_part, #text_part=, #to, #to=, #to_addrs, #to_s, #transfer_encoding, #transport_encoding, #transport_encoding=
Methods included from Utilities
#atom_safe?, #bracket, #capitalize_field, #constantize, #dasherize, #dquote, #escape_paren, #map_lines, #map_with_index, #match_to_s, #paren, #quote_atom, #quote_phrase, #quote_token, #token_safe?, #unbracket, #underscoreize, #unparen, #unquote, #uri_escape, #uri_unescape
Constructor Details
This class inherits a constructor from Mail::Message
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Mail::Message
Instance Method Details
#action ⇒ Object
Either returns the action if the message has just a single report, or an array of all the actions, one for each report
64
65
66
|
# File 'lib/mail/part.rb', line 64
def action
get_return_values('action')
end
|
#add_content_id(content_id_val = '') ⇒ Object
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.
11
12
13
|
# File 'lib/mail/part.rb', line 11
def add_content_id(content_id_val = '')
['content-id'] = content_id_val
end
|
#add_required_fields ⇒ Object
40
41
42
43
|
# File 'lib/mail/part.rb', line 40
def add_required_fields
add_content_id unless has_content_id?
super
end
|
#bounced? ⇒ Boolean
53
54
55
56
57
58
59
|
# File 'lib/mail/part.rb', line 53
def bounced?
if action.is_a?(Array)
!!(action.first =~ /failed/i)
else
!!(action =~ /failed/i)
end
end
|
#cid ⇒ Object
27
28
29
30
|
# File 'lib/mail/part.rb', line 27
def cid
add_content_id unless has_content_id?
uri_escape(unbracket(content_id))
end
|
#delivery_status_data ⇒ Object
49
50
51
|
# File 'lib/mail/part.rb', line 49
def delivery_status_data
delivery_status_report_part? ? parse_delivery_status_report : {}
end
|
#delivery_status_report_part? ⇒ Boolean
45
46
47
|
# File 'lib/mail/part.rb', line 45
def delivery_status_report_part?
(main_type =~ /message/i && sub_type =~ /delivery-status/i) && body =~ /Status:/
end
|
#diagnostic_code ⇒ Object
76
77
78
|
# File 'lib/mail/part.rb', line 76
def diagnostic_code
get_return_values('diagnostic-code')
end
|
#error_status ⇒ Object
72
73
74
|
# File 'lib/mail/part.rb', line 72
def error_status
get_return_values('status')
end
|
#final_recipient ⇒ Object
68
69
70
|
# File 'lib/mail/part.rb', line 68
def final_recipient
get_return_values('final-recipient')
end
|
#has_content_id? ⇒ Boolean
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.
17
18
19
|
# File 'lib/mail/part.rb', line 17
def has_content_id?
.has_content_id?
end
|
#inline? ⇒ Boolean
36
37
38
|
# File 'lib/mail/part.rb', line 36
def inline?
[:content_disposition].disposition_type == 'inline' if [:content_disposition]
end
|
#inline_content_id ⇒ Object
21
22
23
24
25
|
# File 'lib/mail/part.rb', line 21
def inline_content_id
STDERR.puts("Part#inline_content_id is deprecated, please call Part#cid instead")
cid
end
|
#remote_mta ⇒ Object
80
81
82
|
# File 'lib/mail/part.rb', line 80
def remote_mta
get_return_values('remote-mta')
end
|
#retryable? ⇒ Boolean
84
85
86
|
# File 'lib/mail/part.rb', line 84
def retryable?
!(error_status =~ /^5/)
end
|
#url ⇒ Object
32
33
34
|
# File 'lib/mail/part.rb', line 32
def url
"cid:#{cid}"
end
|