mail 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mail might be problematic. Click here for more details.
- data/.gitignore +4 -0
- data/Manifest.txt +106 -0
- data/README.rdoc +441 -0
- data/Rakefile +38 -0
- data/lib/mail.rb +86 -0
- data/lib/mail/attachment.rb +90 -0
- data/lib/mail/body.rb +149 -0
- data/lib/mail/configuration.rb +90 -0
- data/lib/mail/core_extensions.rb +6 -0
- data/lib/mail/core_extensions/blank.rb +41 -0
- data/lib/mail/core_extensions/nil.rb +15 -0
- data/lib/mail/core_extensions/string.rb +31 -0
- data/lib/mail/elements/address.rb +293 -0
- data/lib/mail/elements/address_list.rb +62 -0
- data/lib/mail/elements/content_disposition_element.rb +34 -0
- data/lib/mail/elements/content_transfer_encoding_element.rb +21 -0
- data/lib/mail/elements/content_type_element.rb +39 -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/base64.rb +17 -0
- data/lib/mail/encodings/encodings.rb +24 -0
- data/lib/mail/encodings/quoted_printable.rb +26 -0
- data/lib/mail/envelope.rb +35 -0
- data/lib/mail/field.rb +202 -0
- data/lib/mail/field_list.rb +33 -0
- data/lib/mail/fields/bcc_field.rb +40 -0
- data/lib/mail/fields/cc_field.rb +40 -0
- data/lib/mail/fields/comments_field.rb +41 -0
- data/lib/mail/fields/common/common_address.rb +62 -0
- data/lib/mail/fields/common/common_date.rb +35 -0
- data/lib/mail/fields/common/common_field.rb +128 -0
- data/lib/mail/fields/common/common_message_id.rb +35 -0
- data/lib/mail/fields/content_description_field.rb +15 -0
- data/lib/mail/fields/content_disposition_field.rb +34 -0
- data/lib/mail/fields/content_id_field.rb +50 -0
- data/lib/mail/fields/content_transfer_encoding_field.rb +28 -0
- data/lib/mail/fields/content_type_field.rb +50 -0
- data/lib/mail/fields/date_field.rb +44 -0
- data/lib/mail/fields/from_field.rb +40 -0
- data/lib/mail/fields/in_reply_to_field.rb +42 -0
- data/lib/mail/fields/keywords_field.rb +22 -0
- data/lib/mail/fields/message_id_field.rb +70 -0
- data/lib/mail/fields/mime_version_field.rb +42 -0
- data/lib/mail/fields/optional_field.rb +11 -0
- data/lib/mail/fields/received_field.rb +49 -0
- data/lib/mail/fields/references_field.rb +42 -0
- data/lib/mail/fields/reply_to_field.rb +40 -0
- data/lib/mail/fields/resent_bcc_field.rb +40 -0
- data/lib/mail/fields/resent_cc_field.rb +40 -0
- data/lib/mail/fields/resent_date_field.rb +16 -0
- data/lib/mail/fields/resent_from_field.rb +40 -0
- data/lib/mail/fields/resent_message_id_field.rb +20 -0
- data/lib/mail/fields/resent_sender_field.rb +48 -0
- data/lib/mail/fields/resent_to_field.rb +40 -0
- data/lib/mail/fields/return_path_field.rb +34 -0
- data/lib/mail/fields/sender_field.rb +48 -0
- data/lib/mail/fields/structured_field.rb +32 -0
- data/lib/mail/fields/subject_field.rb +14 -0
- data/lib/mail/fields/to_field.rb +40 -0
- data/lib/mail/fields/unstructured_field.rb +27 -0
- data/lib/mail/header.rb +213 -0
- data/lib/mail/mail.rb +120 -0
- data/lib/mail/message.rb +648 -0
- data/lib/mail/network/deliverable.rb +42 -0
- data/lib/mail/network/retrievable.rb +63 -0
- data/lib/mail/parsers/address_lists.rb +61 -0
- data/lib/mail/parsers/address_lists.treetop +19 -0
- data/lib/mail/parsers/content_disposition.rb +358 -0
- data/lib/mail/parsers/content_disposition.treetop +45 -0
- data/lib/mail/parsers/content_transfer_encoding.rb +179 -0
- data/lib/mail/parsers/content_transfer_encoding.treetop +25 -0
- data/lib/mail/parsers/content_type.rb +507 -0
- data/lib/mail/parsers/content_type.treetop +58 -0
- data/lib/mail/parsers/date_time.rb +111 -0
- data/lib/mail/parsers/date_time.treetop +11 -0
- data/lib/mail/parsers/envelope_from.rb +188 -0
- data/lib/mail/parsers/envelope_from.treetop +32 -0
- data/lib/mail/parsers/message_ids.rb +42 -0
- data/lib/mail/parsers/message_ids.treetop +15 -0
- data/lib/mail/parsers/mime_version.rb +141 -0
- data/lib/mail/parsers/mime_version.treetop +19 -0
- data/lib/mail/parsers/phrase_lists.rb +42 -0
- data/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/lib/mail/parsers/received.rb +68 -0
- data/lib/mail/parsers/received.treetop +11 -0
- data/lib/mail/parsers/rfc2045.rb +406 -0
- data/lib/mail/parsers/rfc2045.treetop +35 -0
- data/lib/mail/parsers/rfc2822.rb +5005 -0
- data/lib/mail/parsers/rfc2822.treetop +402 -0
- data/lib/mail/parsers/rfc2822_obsolete.rb +3607 -0
- data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/lib/mail/part.rb +120 -0
- data/lib/mail/patterns.rb +42 -0
- data/lib/mail/utilities.rb +142 -0
- data/lib/mail/version.rb +10 -0
- data/lib/mail/version_specific/multibyte.rb +62 -0
- data/lib/mail/version_specific/multibyte/chars.rb +701 -0
- data/lib/mail/version_specific/multibyte/exceptions.rb +8 -0
- data/lib/mail/version_specific/multibyte/unicode_database.rb +71 -0
- data/lib/mail/version_specific/ruby_1_8.rb +61 -0
- data/lib/mail/version_specific/ruby_1_8_string.rb +88 -0
- data/lib/mail/version_specific/ruby_1_9.rb +49 -0
- metadata +192 -0
@@ -0,0 +1,42 @@
|
|
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 #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReferencesField:0x180e1c4
|
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.to_s #=> '<F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom>'
|
28
|
+
# mail.references.message_ids #=> ['F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom']
|
29
|
+
#
|
30
|
+
module Mail
|
31
|
+
class ReferencesField < StructuredField
|
32
|
+
|
33
|
+
include CommonMessageId
|
34
|
+
|
35
|
+
FIELD_NAME = 'references'
|
36
|
+
|
37
|
+
def initialize(*args)
|
38
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
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.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.reply_to.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.reply_to.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
module Mail
|
29
|
+
class ReplyToField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'reply-to'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
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.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.resent_bcc.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.resent_bcc.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
module Mail
|
29
|
+
class ResentBccField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'resent-bcc'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
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.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.resent_cc.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.resent_cc.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
module Mail
|
29
|
+
class ResentCcField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'resent-cc'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# resent-date = "Resent-Date:" date-time CRLF
|
4
|
+
module Mail
|
5
|
+
class ResentDateField < StructuredField
|
6
|
+
|
7
|
+
include Mail::CommonDate
|
8
|
+
|
9
|
+
FIELD_NAME = 'resent-date'
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
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.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.resent_from.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.resent_from.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
module Mail
|
29
|
+
class ResentFromField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'resent-from'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# resent-msg-id = "Resent-Message-ID:" msg-id CRLF
|
4
|
+
module Mail
|
5
|
+
class ResentMessageIdField < StructuredField
|
6
|
+
|
7
|
+
include CommonMessageId
|
8
|
+
|
9
|
+
FIELD_NAME = 'resent-message-id'
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
'Resent-Message-ID'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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
|
+
module Mail
|
29
|
+
class ResentSenderField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'resent-sender'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
def addresses
|
40
|
+
[address]
|
41
|
+
end
|
42
|
+
|
43
|
+
def address
|
44
|
+
result = tree.addresses.first
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
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.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.resent_to.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.resent_to.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
module Mail
|
29
|
+
class ResentToField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'resent-to'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# trace = [return]
|
4
|
+
# 1*received
|
5
|
+
#
|
6
|
+
# return = "Return-Path:" path CRLF
|
7
|
+
#
|
8
|
+
# path = ([CFWS] "<" ([CFWS] / addr-spec) ">" [CFWS]) /
|
9
|
+
# obs-path
|
10
|
+
#
|
11
|
+
# received = "Received:" name-val-list ";" date-time CRLF
|
12
|
+
#
|
13
|
+
# name-val-list = [CFWS] [name-val-pair *(CFWS name-val-pair)]
|
14
|
+
#
|
15
|
+
# name-val-pair = item-name CFWS item-value
|
16
|
+
#
|
17
|
+
# item-name = ALPHA *(["-"] (ALPHA / DIGIT))
|
18
|
+
#
|
19
|
+
# item-value = 1*angle-addr / addr-spec /
|
20
|
+
# atom / domain / msg-id
|
21
|
+
#
|
22
|
+
module Mail
|
23
|
+
class ReturnPathField < StructuredField
|
24
|
+
|
25
|
+
include CommonAddress
|
26
|
+
|
27
|
+
FIELD_NAME = 'return-path'
|
28
|
+
|
29
|
+
def initialize(*args)
|
30
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Sender Field
|
4
|
+
#
|
5
|
+
# The Sender field inherits sender StructuredField and handles the Sender: header
|
6
|
+
# field in the email.
|
7
|
+
#
|
8
|
+
# Sending sender to a mail message will instantiate a Mail::Field object that
|
9
|
+
# has a SenderField as it's field type. This includes all Mail::CommonAddress
|
10
|
+
# module instance metods.
|
11
|
+
#
|
12
|
+
# Only one 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.sender = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
19
|
+
# mail.sender #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
|
20
|
+
# mail[:sender] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
|
21
|
+
# mail['sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
|
22
|
+
# mail['Sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::SenderField:0x180e1c4
|
23
|
+
#
|
24
|
+
# mail.sender.to_s #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
25
|
+
# mail.sender.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
26
|
+
# mail.sender.formatted #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
|
27
|
+
#
|
28
|
+
module Mail
|
29
|
+
class SenderField < StructuredField
|
30
|
+
|
31
|
+
include Mail::CommonAddress
|
32
|
+
|
33
|
+
FIELD_NAME = 'sender'
|
34
|
+
|
35
|
+
def initialize(*args)
|
36
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
37
|
+
end
|
38
|
+
|
39
|
+
def addresses
|
40
|
+
[address]
|
41
|
+
end
|
42
|
+
|
43
|
+
def address
|
44
|
+
result = tree.addresses.first
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Mail
|
3
|
+
# Provides access to a structured header field
|
4
|
+
#
|
5
|
+
# ===Per RFC 2822:
|
6
|
+
# 2.2.2. Structured Header Field Bodies
|
7
|
+
#
|
8
|
+
# Some field bodies in this standard have specific syntactical
|
9
|
+
# structure more restrictive than the unstructured field bodies
|
10
|
+
# described above. These are referred to as "structured" field bodies.
|
11
|
+
# Structured field bodies are sequences of specific lexical tokens as
|
12
|
+
# described in sections 3 and 4 of this standard. Many of these tokens
|
13
|
+
# are allowed (according to their syntax) to be introduced or end with
|
14
|
+
# comments (as described in section 3.2.3) as well as the space (SP,
|
15
|
+
# ASCII value 32) and horizontal tab (HTAB, ASCII value 9) characters
|
16
|
+
# (together known as the white space characters, WSP), and those WSP
|
17
|
+
# characters are subject to header "folding" and "unfolding" as
|
18
|
+
# described in section 2.2.3. Semantic analysis of structured field
|
19
|
+
# bodies is given along with their syntax.
|
20
|
+
class StructuredField
|
21
|
+
|
22
|
+
include Mail::CommonField
|
23
|
+
include Mail::Utilities
|
24
|
+
|
25
|
+
def initialize(*args)
|
26
|
+
self.name = args.first
|
27
|
+
self.value = args.last
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|