otherinbox-mail 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +607 -0
- data/CONTRIBUTING.md +45 -0
- data/Dependencies.txt +3 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +44 -0
- data/README.md +663 -0
- data/Rakefile +40 -0
- data/TODO.rdoc +9 -0
- data/lib/VERSION +4 -0
- data/lib/mail.rb +101 -0
- data/lib/mail/attachments_list.rb +104 -0
- data/lib/mail/body.rb +291 -0
- data/lib/mail/configuration.rb +75 -0
- data/lib/mail/core_extensions/nil.rb +17 -0
- data/lib/mail/core_extensions/object.rb +13 -0
- data/lib/mail/core_extensions/shell_escape.rb +56 -0
- data/lib/mail/core_extensions/smtp.rb +25 -0
- data/lib/mail/core_extensions/string.rb +33 -0
- data/lib/mail/core_extensions/string/access.rb +145 -0
- data/lib/mail/core_extensions/string/multibyte.rb +78 -0
- data/lib/mail/elements.rb +14 -0
- data/lib/mail/elements/address.rb +306 -0
- data/lib/mail/elements/address_list.rb +74 -0
- data/lib/mail/elements/content_disposition_element.rb +30 -0
- data/lib/mail/elements/content_location_element.rb +25 -0
- data/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
- data/lib/mail/elements/content_type_element.rb +35 -0
- data/lib/mail/elements/date_time_element.rb +26 -0
- data/lib/mail/elements/envelope_from_element.rb +34 -0
- data/lib/mail/elements/message_ids_element.rb +29 -0
- data/lib/mail/elements/mime_version_element.rb +26 -0
- data/lib/mail/elements/phrase_list.rb +21 -0
- data/lib/mail/elements/received_element.rb +30 -0
- data/lib/mail/encodings.rb +274 -0
- data/lib/mail/encodings/7bit.rb +31 -0
- data/lib/mail/encodings/8bit.rb +31 -0
- data/lib/mail/encodings/base64.rb +33 -0
- data/lib/mail/encodings/binary.rb +31 -0
- data/lib/mail/encodings/quoted_printable.rb +38 -0
- data/lib/mail/encodings/transfer_encoding.rb +58 -0
- data/lib/mail/envelope.rb +35 -0
- data/lib/mail/field.rb +234 -0
- data/lib/mail/field_list.rb +33 -0
- data/lib/mail/fields.rb +35 -0
- data/lib/mail/fields/bcc_field.rb +56 -0
- data/lib/mail/fields/cc_field.rb +55 -0
- data/lib/mail/fields/comments_field.rb +41 -0
- data/lib/mail/fields/common/address_container.rb +16 -0
- data/lib/mail/fields/common/common_address.rb +125 -0
- data/lib/mail/fields/common/common_date.rb +42 -0
- data/lib/mail/fields/common/common_field.rb +51 -0
- data/lib/mail/fields/common/common_message_id.rb +44 -0
- data/lib/mail/fields/common/parameter_hash.rb +58 -0
- data/lib/mail/fields/content_description_field.rb +19 -0
- data/lib/mail/fields/content_disposition_field.rb +69 -0
- data/lib/mail/fields/content_id_field.rb +63 -0
- data/lib/mail/fields/content_location_field.rb +42 -0
- data/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
- data/lib/mail/fields/content_type_field.rb +198 -0
- data/lib/mail/fields/date_field.rb +57 -0
- data/lib/mail/fields/from_field.rb +55 -0
- data/lib/mail/fields/in_reply_to_field.rb +55 -0
- data/lib/mail/fields/keywords_field.rb +44 -0
- data/lib/mail/fields/message_id_field.rb +83 -0
- data/lib/mail/fields/mime_version_field.rb +53 -0
- data/lib/mail/fields/optional_field.rb +13 -0
- data/lib/mail/fields/received_field.rb +75 -0
- data/lib/mail/fields/references_field.rb +55 -0
- data/lib/mail/fields/reply_to_field.rb +55 -0
- data/lib/mail/fields/resent_bcc_field.rb +55 -0
- data/lib/mail/fields/resent_cc_field.rb +55 -0
- data/lib/mail/fields/resent_date_field.rb +35 -0
- data/lib/mail/fields/resent_from_field.rb +55 -0
- data/lib/mail/fields/resent_message_id_field.rb +34 -0
- data/lib/mail/fields/resent_sender_field.rb +62 -0
- data/lib/mail/fields/resent_to_field.rb +55 -0
- data/lib/mail/fields/return_path_field.rb +65 -0
- data/lib/mail/fields/sender_field.rb +67 -0
- data/lib/mail/fields/structured_field.rb +51 -0
- data/lib/mail/fields/subject_field.rb +16 -0
- data/lib/mail/fields/to_field.rb +55 -0
- data/lib/mail/fields/unstructured_field.rb +191 -0
- data/lib/mail/header.rb +265 -0
- data/lib/mail/indifferent_hash.rb +146 -0
- data/lib/mail/mail.rb +255 -0
- data/lib/mail/matchers/has_sent_mail.rb +124 -0
- data/lib/mail/message.rb +2059 -0
- data/lib/mail/multibyte.rb +42 -0
- data/lib/mail/multibyte/chars.rb +474 -0
- data/lib/mail/multibyte/exceptions.rb +8 -0
- data/lib/mail/multibyte/unicode.rb +392 -0
- data/lib/mail/multibyte/utils.rb +60 -0
- data/lib/mail/network.rb +14 -0
- data/lib/mail/network/delivery_methods/exim.rb +53 -0
- data/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
- data/lib/mail/network/delivery_methods/sendmail.rb +62 -0
- data/lib/mail/network/delivery_methods/smtp.rb +153 -0
- data/lib/mail/network/delivery_methods/smtp_connection.rb +74 -0
- data/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
- data/lib/mail/network/retriever_methods/base.rb +63 -0
- data/lib/mail/network/retriever_methods/imap.rb +168 -0
- data/lib/mail/network/retriever_methods/pop3.rb +140 -0
- data/lib/mail/network/retriever_methods/test_retriever.rb +47 -0
- data/lib/mail/parsers/address_lists.rb +64 -0
- data/lib/mail/parsers/address_lists.treetop +19 -0
- data/lib/mail/parsers/content_disposition.rb +535 -0
- data/lib/mail/parsers/content_disposition.treetop +46 -0
- data/lib/mail/parsers/content_location.rb +139 -0
- data/lib/mail/parsers/content_location.treetop +20 -0
- data/lib/mail/parsers/content_transfer_encoding.rb +162 -0
- data/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
- data/lib/mail/parsers/content_type.rb +967 -0
- data/lib/mail/parsers/content_type.treetop +68 -0
- data/lib/mail/parsers/date_time.rb +114 -0
- data/lib/mail/parsers/date_time.treetop +11 -0
- data/lib/mail/parsers/envelope_from.rb +194 -0
- data/lib/mail/parsers/envelope_from.treetop +32 -0
- data/lib/mail/parsers/message_ids.rb +45 -0
- data/lib/mail/parsers/message_ids.treetop +15 -0
- data/lib/mail/parsers/mime_version.rb +144 -0
- data/lib/mail/parsers/mime_version.treetop +19 -0
- data/lib/mail/parsers/phrase_lists.rb +45 -0
- data/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/lib/mail/parsers/received.rb +71 -0
- data/lib/mail/parsers/received.treetop +11 -0
- data/lib/mail/parsers/rfc2045.rb +464 -0
- data/lib/mail/parsers/rfc2045.treetop +36 -0
- data/lib/mail/parsers/rfc2822.rb +5341 -0
- data/lib/mail/parsers/rfc2822.treetop +410 -0
- data/lib/mail/parsers/rfc2822_obsolete.rb +3768 -0
- data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/lib/mail/part.rb +116 -0
- data/lib/mail/parts_list.rb +55 -0
- data/lib/mail/patterns.rb +34 -0
- data/lib/mail/utilities.rb +215 -0
- data/lib/mail/version.rb +24 -0
- data/lib/mail/version_specific/ruby_1_8.rb +98 -0
- data/lib/mail/version_specific/ruby_1_9.rb +113 -0
- data/lib/tasks/corpus.rake +125 -0
- data/lib/tasks/treetop.rake +10 -0
- metadata +253 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = References Field
|
4
|
+
#
|
5
|
+
# The References field inherits references StructuredField and handles the References: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending references to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ReferencesField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Note that, the #message_ids method will return an array of message IDs without the
|
13
|
+
# enclosing angle brackets which per RFC are not syntactically part of the message id.
|
14
|
+
#
|
15
|
+
# Only one References field can appear in a header, though it can have multiple
|
16
|
+
# Message IDs.
|
17
|
+
#
|
18
|
+
# == Examples:
|
19
|
+
#
|
20
|
+
# mail = Mail.new
|
21
|
+
# mail.references = '<F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom>'
|
22
|
+
# mail.references #=> '<F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom>'
|
23
|
+
# mail[:references] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
|
24
|
+
# mail['references'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
|
25
|
+
# mail['References'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
|
26
|
+
#
|
27
|
+
# mail[:references].message_ids #=> ['F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom']
|
28
|
+
#
|
29
|
+
require 'mail/fields/common/common_message_id'
|
30
|
+
|
31
|
+
module Mail
|
32
|
+
class ReferencesField < StructuredField
|
33
|
+
|
34
|
+
include CommonMessageId
|
35
|
+
|
36
|
+
FIELD_NAME = 'references'
|
37
|
+
CAPITALIZED_FIELD = 'References'
|
38
|
+
|
39
|
+
def initialize(value = nil, charset = 'utf-8')
|
40
|
+
self.charset = charset
|
41
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
42
|
+
self.parse
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def encoded
|
47
|
+
do_encode(CAPITALIZED_FIELD)
|
48
|
+
end
|
49
|
+
|
50
|
+
def decoded
|
51
|
+
do_decode
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Reply-To Field
|
4
|
+
#
|
5
|
+
# The Reply-To field inherits reply-to StructuredField and handles the Reply-To: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending reply_to to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ReplyToField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one Reply-To field can appear in a header, though it can have multiple
|
13
|
+
# addresses and groups of addresses.
|
14
|
+
#
|
15
|
+
# == Examples:
|
16
|
+
#
|
17
|
+
# mail = Mail.new
|
18
|
+
# mail.reply_to = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.reply_to #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
20
|
+
# mail[:reply_to] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
21
|
+
# mail['reply-to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
22
|
+
# mail['Reply-To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail[:reply_to].encoded #=> 'Reply-To: Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net\r\n'
|
25
|
+
# mail[:reply_to].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
26
|
+
# mail[:reply_to].addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
27
|
+
# mail[:reply_to].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
28
|
+
#
|
29
|
+
require 'mail/fields/common/common_address'
|
30
|
+
|
31
|
+
module Mail
|
32
|
+
class ReplyToField < StructuredField
|
33
|
+
|
34
|
+
include Mail::CommonAddress
|
35
|
+
|
36
|
+
FIELD_NAME = 'reply-to'
|
37
|
+
CAPITALIZED_FIELD = 'Reply-To'
|
38
|
+
|
39
|
+
def initialize(value = nil, charset = 'utf-8')
|
40
|
+
self.charset = charset
|
41
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
42
|
+
self.parse
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def encoded
|
47
|
+
do_encode(CAPITALIZED_FIELD)
|
48
|
+
end
|
49
|
+
|
50
|
+
def decoded
|
51
|
+
do_decode
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Resent-Bcc Field
|
4
|
+
#
|
5
|
+
# The Resent-Bcc field inherits resent-bcc StructuredField and handles the
|
6
|
+
# Resent-Bcc: header field in the email.
|
7
|
+
#
|
8
|
+
# Sending resent_bcc to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ResentBccField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one Resent-Bcc field can appear in a header, though it can have multiple
|
13
|
+
# addresses and groups of addresses.
|
14
|
+
#
|
15
|
+
# == Examples:
|
16
|
+
#
|
17
|
+
# mail = Mail.new
|
18
|
+
# mail.resent_bcc = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.resent_bcc #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
20
|
+
# mail[:resent_bcc] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
21
|
+
# mail['resent-bcc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
22
|
+
# mail['Resent-Bcc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail[:resent_bcc].encoded #=> 'Resent-Bcc: Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net\r\n'
|
25
|
+
# mail[:resent_bcc].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
26
|
+
# mail[:resent_bcc].addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
27
|
+
# mail[:resent_bcc].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
28
|
+
#
|
29
|
+
require 'mail/fields/common/common_address'
|
30
|
+
|
31
|
+
module Mail
|
32
|
+
class ResentBccField < StructuredField
|
33
|
+
|
34
|
+
include Mail::CommonAddress
|
35
|
+
|
36
|
+
FIELD_NAME = 'resent-bcc'
|
37
|
+
CAPITALIZED_FIELD = 'Resent-Bcc'
|
38
|
+
|
39
|
+
def initialize(value = nil, charset = 'utf-8')
|
40
|
+
self.charset = charset
|
41
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
42
|
+
self.parse
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def encoded
|
47
|
+
do_encode(CAPITALIZED_FIELD)
|
48
|
+
end
|
49
|
+
|
50
|
+
def decoded
|
51
|
+
do_decode
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Resent-Cc Field
|
4
|
+
#
|
5
|
+
# The Resent-Cc field inherits resent-cc StructuredField and handles the Resent-Cc: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending resent_cc to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ResentCcField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one Resent-Cc field can appear in a header, though it can have multiple
|
13
|
+
# addresses and groups of addresses.
|
14
|
+
#
|
15
|
+
# == Examples:
|
16
|
+
#
|
17
|
+
# mail = Mail.new
|
18
|
+
# mail.resent_cc = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.resent_cc #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
20
|
+
# mail[:resent_cc] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
21
|
+
# mail['resent-cc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
22
|
+
# mail['Resent-Cc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail[:resent_cc].encoded #=> 'Resent-Cc: Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net\r\n'
|
25
|
+
# mail[:resent_cc].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
26
|
+
# mail[:resent_cc].addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
27
|
+
# mail[:resent_cc].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
28
|
+
#
|
29
|
+
require 'mail/fields/common/common_address'
|
30
|
+
|
31
|
+
module Mail
|
32
|
+
class ResentCcField < StructuredField
|
33
|
+
|
34
|
+
include Mail::CommonAddress
|
35
|
+
|
36
|
+
FIELD_NAME = 'resent-cc'
|
37
|
+
CAPITALIZED_FIELD = 'Resent-Cc'
|
38
|
+
|
39
|
+
def initialize(value = nil, charset = 'utf-8')
|
40
|
+
self.charset = charset
|
41
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
42
|
+
self.parse
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def encoded
|
47
|
+
do_encode(CAPITALIZED_FIELD)
|
48
|
+
end
|
49
|
+
|
50
|
+
def decoded
|
51
|
+
do_decode
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# resent-date = "Resent-Date:" date-time CRLF
|
4
|
+
require 'mail/fields/common/common_date'
|
5
|
+
|
6
|
+
module Mail
|
7
|
+
class ResentDateField < StructuredField
|
8
|
+
|
9
|
+
include Mail::CommonDate
|
10
|
+
|
11
|
+
FIELD_NAME = 'resent-date'
|
12
|
+
CAPITALIZED_FIELD = 'Resent-Date'
|
13
|
+
|
14
|
+
def initialize(value = nil, charset = 'utf-8')
|
15
|
+
self.charset = charset
|
16
|
+
if value.blank?
|
17
|
+
value = ::DateTime.now.strftime('%a, %d %b %Y %H:%M:%S %z')
|
18
|
+
else
|
19
|
+
value = strip_field(FIELD_NAME, value)
|
20
|
+
value = ::DateTime.parse(value.to_s).strftime('%a, %d %b %Y %H:%M:%S %z')
|
21
|
+
end
|
22
|
+
super(CAPITALIZED_FIELD, value, charset)
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def encoded
|
27
|
+
do_encode(CAPITALIZED_FIELD)
|
28
|
+
end
|
29
|
+
|
30
|
+
def decoded
|
31
|
+
do_decode
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Resent-From Field
|
4
|
+
#
|
5
|
+
# The Resent-From field inherits resent-from StructuredField and handles the Resent-From: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending resent_from to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ResentFromField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one Resent-From field can appear in a header, though it can have multiple
|
13
|
+
# addresses and groups of addresses.
|
14
|
+
#
|
15
|
+
# == Examples:
|
16
|
+
#
|
17
|
+
# mail = Mail.new
|
18
|
+
# mail.resent_from = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.resent_from #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
20
|
+
# mail[:resent_from] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
21
|
+
# mail['resent-from'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
22
|
+
# mail['Resent-From'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail[:resent_from].encoded #=> 'Resent-From: Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net\r\n'
|
25
|
+
# mail[:resent_from].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
26
|
+
# mail[:resent_from].addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
27
|
+
# mail[:resent_from].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
28
|
+
#
|
29
|
+
require 'mail/fields/common/common_address'
|
30
|
+
|
31
|
+
module Mail
|
32
|
+
class ResentFromField < StructuredField
|
33
|
+
|
34
|
+
include Mail::CommonAddress
|
35
|
+
|
36
|
+
FIELD_NAME = 'resent-from'
|
37
|
+
CAPITALIZED_FIELD = 'Resent-From'
|
38
|
+
|
39
|
+
def initialize(value = nil, charset = 'utf-8')
|
40
|
+
self.charset = charset
|
41
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
42
|
+
self.parse
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def encoded
|
47
|
+
do_encode(CAPITALIZED_FIELD)
|
48
|
+
end
|
49
|
+
|
50
|
+
def decoded
|
51
|
+
do_decode
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# resent-msg-id = "Resent-Message-ID:" msg-id CRLF
|
4
|
+
require 'mail/fields/common/common_message_id'
|
5
|
+
|
6
|
+
module Mail
|
7
|
+
class ResentMessageIdField < StructuredField
|
8
|
+
|
9
|
+
include CommonMessageId
|
10
|
+
|
11
|
+
FIELD_NAME = 'resent-message-id'
|
12
|
+
CAPITALIZED_FIELD = 'Resent-Message-ID'
|
13
|
+
|
14
|
+
def initialize(value = nil, charset = 'utf-8')
|
15
|
+
self.charset = charset
|
16
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
17
|
+
self.parse
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def name
|
22
|
+
'Resent-Message-ID'
|
23
|
+
end
|
24
|
+
|
25
|
+
def encoded
|
26
|
+
do_encode(CAPITALIZED_FIELD)
|
27
|
+
end
|
28
|
+
|
29
|
+
def decoded
|
30
|
+
do_decode
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Resent-Sender Field
|
4
|
+
#
|
5
|
+
# The Resent-Sender field inherits resent-sender StructuredField and handles the Resent-Sender: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending resent_sender to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ResentSenderField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one Resent-Sender field can appear in a header, though it can have multiple
|
13
|
+
# addresses and groups of addresses.
|
14
|
+
#
|
15
|
+
# == Examples:
|
16
|
+
#
|
17
|
+
# mail = Mail.new
|
18
|
+
# mail.resent_sender = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.resent_sender #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
20
|
+
# mail[:resent_sender] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
21
|
+
# mail['resent-sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
22
|
+
# mail['Resent-Sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail.resent_sender.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.resent_sender.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.resent_sender.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
require 'mail/fields/common/common_address'
|
29
|
+
|
30
|
+
module Mail
|
31
|
+
class ResentSenderField < StructuredField
|
32
|
+
|
33
|
+
include Mail::CommonAddress
|
34
|
+
|
35
|
+
FIELD_NAME = 'resent-sender'
|
36
|
+
CAPITALIZED_FIELD = 'Resent-Sender'
|
37
|
+
|
38
|
+
def initialize(value = nil, charset = 'utf-8')
|
39
|
+
self.charset = charset
|
40
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
41
|
+
self.parse
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
def addresses
|
46
|
+
[address.address]
|
47
|
+
end
|
48
|
+
|
49
|
+
def address
|
50
|
+
tree.addresses.first
|
51
|
+
end
|
52
|
+
|
53
|
+
def encoded
|
54
|
+
do_encode(CAPITALIZED_FIELD)
|
55
|
+
end
|
56
|
+
|
57
|
+
def decoded
|
58
|
+
do_decode
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Resent-To Field
|
4
|
+
#
|
5
|
+
# The Resent-To field inherits resent-to StructuredField and handles the Resent-To: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending resent_to to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a ResentToField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one Resent-To field can appear in a header, though it can have multiple
|
13
|
+
# addresses and groups of addresses.
|
14
|
+
#
|
15
|
+
# == Examples:
|
16
|
+
#
|
17
|
+
# mail = Mail.new
|
18
|
+
# mail.resent_to = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.resent_to #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
20
|
+
# mail[:resent_to] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
21
|
+
# mail['resent-to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
22
|
+
# mail['Resent-To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail[:resent_to].encoded #=> 'Resent-To: Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net\r\n'
|
25
|
+
# mail[:resent_to].decoded #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
26
|
+
# mail[:resent_to].addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
27
|
+
# mail[:resent_to].formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
28
|
+
#
|
29
|
+
require 'mail/fields/common/common_address'
|
30
|
+
|
31
|
+
module Mail
|
32
|
+
class ResentToField < StructuredField
|
33
|
+
|
34
|
+
include Mail::CommonAddress
|
35
|
+
|
36
|
+
FIELD_NAME = 'resent-to'
|
37
|
+
CAPITALIZED_FIELD = 'Resent-To'
|
38
|
+
|
39
|
+
def initialize(value = nil, charset = 'utf-8')
|
40
|
+
self.charset = charset
|
41
|
+
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
42
|
+
self.parse
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def encoded
|
47
|
+
do_encode(CAPITALIZED_FIELD)
|
48
|
+
end
|
49
|
+
|
50
|
+
def decoded
|
51
|
+
do_decode
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|