rack-mail_exception 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.rdoc +38 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/lib/rack/mail_exception.rb +103 -0
- data/test/helper.rb +13 -0
- data/test/test_rack_mail_exception.rb +93 -0
- data/vendor/mail/.bundle/config +2 -0
- data/vendor/mail/CHANGELOG.rdoc +370 -0
- data/vendor/mail/Dependencies.txt +3 -0
- data/vendor/mail/Gemfile +17 -0
- data/vendor/mail/README.rdoc +572 -0
- data/vendor/mail/ROADMAP +92 -0
- data/vendor/mail/Rakefile +41 -0
- data/vendor/mail/TODO.rdoc +9 -0
- data/vendor/mail/lib/mail.rb +76 -0
- data/vendor/mail/lib/mail/attachments_list.rb +99 -0
- data/vendor/mail/lib/mail/body.rb +287 -0
- data/vendor/mail/lib/mail/configuration.rb +67 -0
- data/vendor/mail/lib/mail/core_extensions/blank.rb +26 -0
- data/vendor/mail/lib/mail/core_extensions/nil.rb +11 -0
- data/vendor/mail/lib/mail/core_extensions/string.rb +27 -0
- data/vendor/mail/lib/mail/elements.rb +14 -0
- data/vendor/mail/lib/mail/elements/address.rb +306 -0
- data/vendor/mail/lib/mail/elements/address_list.rb +74 -0
- data/vendor/mail/lib/mail/elements/content_disposition_element.rb +30 -0
- data/vendor/mail/lib/mail/elements/content_location_element.rb +25 -0
- data/vendor/mail/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
- data/vendor/mail/lib/mail/elements/content_type_element.rb +35 -0
- data/vendor/mail/lib/mail/elements/date_time_element.rb +26 -0
- data/vendor/mail/lib/mail/elements/envelope_from_element.rb +34 -0
- data/vendor/mail/lib/mail/elements/message_ids_element.rb +29 -0
- data/vendor/mail/lib/mail/elements/mime_version_element.rb +26 -0
- data/vendor/mail/lib/mail/elements/phrase_list.rb +21 -0
- data/vendor/mail/lib/mail/elements/received_element.rb +30 -0
- data/vendor/mail/lib/mail/encodings.rb +258 -0
- data/vendor/mail/lib/mail/encodings/7bit.rb +31 -0
- data/vendor/mail/lib/mail/encodings/8bit.rb +31 -0
- data/vendor/mail/lib/mail/encodings/base64.rb +33 -0
- data/vendor/mail/lib/mail/encodings/binary.rb +31 -0
- data/vendor/mail/lib/mail/encodings/quoted_printable.rb +38 -0
- data/vendor/mail/lib/mail/encodings/transfer_encoding.rb +58 -0
- data/vendor/mail/lib/mail/envelope.rb +35 -0
- data/vendor/mail/lib/mail/field.rb +223 -0
- data/vendor/mail/lib/mail/field_list.rb +33 -0
- data/vendor/mail/lib/mail/fields.rb +35 -0
- data/vendor/mail/lib/mail/fields/bcc_field.rb +56 -0
- data/vendor/mail/lib/mail/fields/cc_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/comments_field.rb +41 -0
- data/vendor/mail/lib/mail/fields/common/address_container.rb +16 -0
- data/vendor/mail/lib/mail/fields/common/common_address.rb +125 -0
- data/vendor/mail/lib/mail/fields/common/common_date.rb +42 -0
- data/vendor/mail/lib/mail/fields/common/common_field.rb +50 -0
- data/vendor/mail/lib/mail/fields/common/common_message_id.rb +43 -0
- data/vendor/mail/lib/mail/fields/common/parameter_hash.rb +52 -0
- data/vendor/mail/lib/mail/fields/content_description_field.rb +19 -0
- data/vendor/mail/lib/mail/fields/content_disposition_field.rb +69 -0
- data/vendor/mail/lib/mail/fields/content_id_field.rb +63 -0
- data/vendor/mail/lib/mail/fields/content_location_field.rb +42 -0
- data/vendor/mail/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
- data/vendor/mail/lib/mail/fields/content_type_field.rb +185 -0
- data/vendor/mail/lib/mail/fields/date_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/from_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/in_reply_to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/keywords_field.rb +44 -0
- data/vendor/mail/lib/mail/fields/message_id_field.rb +83 -0
- data/vendor/mail/lib/mail/fields/mime_version_field.rb +53 -0
- data/vendor/mail/lib/mail/fields/optional_field.rb +13 -0
- data/vendor/mail/lib/mail/fields/received_field.rb +67 -0
- data/vendor/mail/lib/mail/fields/references_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/reply_to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_bcc_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_cc_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_date_field.rb +35 -0
- data/vendor/mail/lib/mail/fields/resent_from_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_message_id_field.rb +34 -0
- data/vendor/mail/lib/mail/fields/resent_sender_field.rb +62 -0
- data/vendor/mail/lib/mail/fields/resent_to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/return_path_field.rb +64 -0
- data/vendor/mail/lib/mail/fields/sender_field.rb +67 -0
- data/vendor/mail/lib/mail/fields/structured_field.rb +51 -0
- data/vendor/mail/lib/mail/fields/subject_field.rb +16 -0
- data/vendor/mail/lib/mail/fields/to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/unstructured_field.rb +166 -0
- data/vendor/mail/lib/mail/header.rb +262 -0
- data/vendor/mail/lib/mail/mail.rb +234 -0
- data/vendor/mail/lib/mail/message.rb +1867 -0
- data/vendor/mail/lib/mail/network.rb +9 -0
- data/vendor/mail/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
- data/vendor/mail/lib/mail/network/delivery_methods/sendmail.rb +62 -0
- data/vendor/mail/lib/mail/network/delivery_methods/smtp.rb +110 -0
- data/vendor/mail/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
- data/vendor/mail/lib/mail/network/retriever_methods/imap.rb +18 -0
- data/vendor/mail/lib/mail/network/retriever_methods/pop3.rb +149 -0
- data/vendor/mail/lib/mail/parsers/address_lists.rb +64 -0
- data/vendor/mail/lib/mail/parsers/address_lists.treetop +19 -0
- data/vendor/mail/lib/mail/parsers/content_disposition.rb +387 -0
- data/vendor/mail/lib/mail/parsers/content_disposition.treetop +46 -0
- data/vendor/mail/lib/mail/parsers/content_location.rb +139 -0
- data/vendor/mail/lib/mail/parsers/content_location.treetop +20 -0
- data/vendor/mail/lib/mail/parsers/content_transfer_encoding.rb +162 -0
- data/vendor/mail/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
- data/vendor/mail/lib/mail/parsers/content_type.rb +539 -0
- data/vendor/mail/lib/mail/parsers/content_type.treetop +58 -0
- data/vendor/mail/lib/mail/parsers/date_time.rb +114 -0
- data/vendor/mail/lib/mail/parsers/date_time.treetop +11 -0
- data/vendor/mail/lib/mail/parsers/envelope_from.rb +194 -0
- data/vendor/mail/lib/mail/parsers/envelope_from.treetop +32 -0
- data/vendor/mail/lib/mail/parsers/message_ids.rb +45 -0
- data/vendor/mail/lib/mail/parsers/message_ids.treetop +15 -0
- data/vendor/mail/lib/mail/parsers/mime_version.rb +144 -0
- data/vendor/mail/lib/mail/parsers/mime_version.treetop +19 -0
- data/vendor/mail/lib/mail/parsers/phrase_lists.rb +45 -0
- data/vendor/mail/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/vendor/mail/lib/mail/parsers/received.rb +71 -0
- data/vendor/mail/lib/mail/parsers/received.treetop +11 -0
- data/vendor/mail/lib/mail/parsers/rfc2045.rb +464 -0
- data/vendor/mail/lib/mail/parsers/rfc2045.treetop +36 -0
- data/vendor/mail/lib/mail/parsers/rfc2822.rb +5318 -0
- data/vendor/mail/lib/mail/parsers/rfc2822.treetop +410 -0
- data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.rb +3757 -0
- data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/vendor/mail/lib/mail/part.rb +102 -0
- data/vendor/mail/lib/mail/parts_list.rb +34 -0
- data/vendor/mail/lib/mail/patterns.rb +30 -0
- data/vendor/mail/lib/mail/utilities.rb +181 -0
- data/vendor/mail/lib/mail/version.rb +10 -0
- data/vendor/mail/lib/mail/version_specific/ruby_1_8.rb +97 -0
- data/vendor/mail/lib/mail/version_specific/ruby_1_9.rb +87 -0
- data/vendor/mail/lib/tasks/corpus.rake +125 -0
- data/vendor/mail/lib/tasks/treetop.rake +10 -0
- data/vendor/mail/mail.gemspec +20 -0
- data/vendor/mail/reference/US ASCII Table.txt +130 -0
- data/vendor/mail/reference/rfc1035 Domain Implementation and Specification.txt +3083 -0
- data/vendor/mail/reference/rfc1049 Content-Type Header Field for Internet Messages.txt +451 -0
- data/vendor/mail/reference/rfc1344 Implications of MIME for Internet Mail Gateways.txt +586 -0
- data/vendor/mail/reference/rfc1345 Character Mnemonics & Character Sets.txt +5761 -0
- data/vendor/mail/reference/rfc1524 A User Agent Configuration Mechanism For Multimedia Mail Format Information.txt +675 -0
- data/vendor/mail/reference/rfc1652 SMTP Service Extension for 8bit-MIMEtransport.txt +339 -0
- data/vendor/mail/reference/rfc1892 Multipart Report .txt +227 -0
- data/vendor/mail/reference/rfc1893 Mail System Status Codes.txt +843 -0
- data/vendor/mail/reference/rfc2045 Multipurpose Internet Mail Extensions (1).txt +1739 -0
- data/vendor/mail/reference/rfc2046 Multipurpose Internet Mail Extensions (2).txt +2467 -0
- data/vendor/mail/reference/rfc2047 Multipurpose Internet Mail Extensions (3).txt +843 -0
- data/vendor/mail/reference/rfc2048 Multipurpose Internet Mail Extensions (4).txt +1180 -0
- data/vendor/mail/reference/rfc2049 Multipurpose Internet Mail Extensions (5).txt +1347 -0
- data/vendor/mail/reference/rfc2111 Content-ID and Message-ID URLs.txt +283 -0
- data/vendor/mail/reference/rfc2183 Content-Disposition Header Field.txt +675 -0
- data/vendor/mail/reference/rfc2231 MIME Parameter Value and Encoded Word Extensions.txt +563 -0
- data/vendor/mail/reference/rfc2387 MIME Multipart-Related Content-type.txt +563 -0
- data/vendor/mail/reference/rfc2821 Simple Mail Transfer Protocol.txt +3711 -0
- data/vendor/mail/reference/rfc2822 Internet Message Format.txt +2859 -0
- data/vendor/mail/reference/rfc3462 Reporting of Mail System Administrative Messages.txt +396 -0
- data/vendor/mail/reference/rfc3696 Checking and Transformation of Names.txt +898 -0
- data/vendor/mail/reference/rfc4155 The application-mbox Media Type.txt +502 -0
- data/vendor/mail/reference/rfc4234 Augmented BNF for Syntax Specifications: ABNF.txt +899 -0
- data/vendor/mail/reference/rfc822 Standard for the Format of ARPA Internet Text Messages.txt +2900 -0
- data/vendor/mail/spec/environment.rb +15 -0
- data/vendor/mail/spec/features/making_a_new_message.feature +14 -0
- data/vendor/mail/spec/features/steps/env.rb +6 -0
- data/vendor/mail/spec/features/steps/making_a_new_message_steps.rb +11 -0
- data/vendor/mail/spec/fixtures/attachments/basic_email.eml +31 -0
- data/vendor/mail/spec/fixtures/attachments/test.gif +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.jpg +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.pdf +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.png +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.tiff +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.zip +0 -0
- data/vendor/mail/spec/fixtures/attachments//343/201/246/343/201/231/343/201/250.txt +2 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_disposition.eml +29 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_location.eml +32 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_message_rfc822.eml +92 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_only_email.eml +17 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_pdf.eml +70 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_encoded_name.eml +47 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_quoted_filename.eml +60 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/cant_parse_from.eml +33 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_7-bit.eml +231 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_empty.eml +33 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_plain.eml +148 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_qp_with_space.eml +53 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_spam.eml +44 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_text-html.eml +50 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_8bits.eml +770 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_semi_colon.eml +269 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_x_uuencode.eml +79 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/empty_group_lists.eml +162 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/header_fields_with_empty_values.eml +33 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/missing_body.eml +16 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/missing_content_disposition.eml +43 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/multiple_content_types.eml +25 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email11.eml +34 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email12.eml +32 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email2.eml +114 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email4.eml +59 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email7.eml +66 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_encoded_stack_level_too_deep.eml +53 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_illegal_boundary.eml +58 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_mimepart_without_content_type.eml +94 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_multipart_mixed_quoted_boundary.eml +50 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_nested_attachment.eml +100 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_quoted_illegal_boundary.eml +58 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/sig_only_email.eml +29 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/two_from_in_message.eml +42 -0
- data/vendor/mail/spec/fixtures/emails/multi_charset/japanese.eml +9 -0
- data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment.eml +27 -0
- data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment_long_name.eml +44 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce1.eml +179 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce2.eml +179 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_422.eml +98 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_530.eml +97 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/basic_email.eml +31 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email10.eml +20 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email5.eml +19 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email6.eml +20 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email8.eml +47 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_bad_time.eml +62 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_double_at_in_header.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_incorrect_header.eml +28 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_multiple_from.eml +30 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_quoted_with_0d0a.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_reply.eml +32 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_simple.eml +11 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_string_in_date_field.eml +17 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_trailing_dot.eml +21 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_bad_date.eml +48 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_partially_quoted_subject.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example01.eml +8 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example02.eml +9 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example03.eml +7 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example04.eml +7 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example05.eml +8 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example06.eml +10 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example07.eml +9 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example08.eml +12 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example09.eml +15 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example10.eml +15 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example11.eml +6 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example12.eml +8 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example13.eml +10 -0
- data/vendor/mail/spec/fixtures/emails/sample_output_multipart +0 -0
- data/vendor/mail/spec/mail/attachments_list_spec.rb +214 -0
- data/vendor/mail/spec/mail/body_spec.rb +385 -0
- data/vendor/mail/spec/mail/configuration_spec.rb +19 -0
- data/vendor/mail/spec/mail/core_extensions/string_spec.rb +62 -0
- data/vendor/mail/spec/mail/core_extensions_spec.rb +99 -0
- data/vendor/mail/spec/mail/elements/address_list_spec.rb +109 -0
- data/vendor/mail/spec/mail/elements/address_spec.rb +609 -0
- data/vendor/mail/spec/mail/elements/date_time_element_spec.rb +20 -0
- data/vendor/mail/spec/mail/elements/envelope_from_element_spec.rb +31 -0
- data/vendor/mail/spec/mail/elements/message_ids_element_spec.rb +43 -0
- data/vendor/mail/spec/mail/elements/phrase_list_spec.rb +22 -0
- data/vendor/mail/spec/mail/elements/received_element_spec.rb +34 -0
- data/vendor/mail/spec/mail/encoding_spec.rb +189 -0
- data/vendor/mail/spec/mail/encodings/base64_spec.rb +25 -0
- data/vendor/mail/spec/mail/encodings/quoted_printable_spec.rb +25 -0
- data/vendor/mail/spec/mail/encodings_spec.rb +664 -0
- data/vendor/mail/spec/mail/example_emails_spec.rb +303 -0
- data/vendor/mail/spec/mail/field_list_spec.rb +33 -0
- data/vendor/mail/spec/mail/field_spec.rb +198 -0
- data/vendor/mail/spec/mail/fields/bcc_field_spec.rb +89 -0
- data/vendor/mail/spec/mail/fields/cc_field_spec.rb +79 -0
- data/vendor/mail/spec/mail/fields/comments_field_spec.rb +25 -0
- data/vendor/mail/spec/mail/fields/common/address_container_spec.rb +18 -0
- data/vendor/mail/spec/mail/fields/common/common_address_spec.rb +132 -0
- data/vendor/mail/spec/mail/fields/common/common_date_spec.rb +25 -0
- data/vendor/mail/spec/mail/fields/common/common_field_spec.rb +69 -0
- data/vendor/mail/spec/mail/fields/common/common_message_id_spec.rb +30 -0
- data/vendor/mail/spec/mail/fields/common/parameter_hash_spec.rb +56 -0
- data/vendor/mail/spec/mail/fields/content_description_field_spec.rb +39 -0
- data/vendor/mail/spec/mail/fields/content_disposition_field_spec.rb +55 -0
- data/vendor/mail/spec/mail/fields/content_id_field_spec.rb +117 -0
- data/vendor/mail/spec/mail/fields/content_location_field_spec.rb +46 -0
- data/vendor/mail/spec/mail/fields/content_transfer_encoding_field_spec.rb +113 -0
- data/vendor/mail/spec/mail/fields/content_type_field_spec.rb +678 -0
- data/vendor/mail/spec/mail/fields/date_field_spec.rb +73 -0
- data/vendor/mail/spec/mail/fields/envelope_spec.rb +48 -0
- data/vendor/mail/spec/mail/fields/from_field_spec.rb +89 -0
- data/vendor/mail/spec/mail/fields/in_reply_to_field_spec.rb +62 -0
- data/vendor/mail/spec/mail/fields/keywords_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/message_id_field_spec.rb +147 -0
- data/vendor/mail/spec/mail/fields/mime_version_field_spec.rb +166 -0
- data/vendor/mail/spec/mail/fields/received_field_spec.rb +44 -0
- data/vendor/mail/spec/mail/fields/references_field_spec.rb +35 -0
- data/vendor/mail/spec/mail/fields/reply_to_field_spec.rb +67 -0
- data/vendor/mail/spec/mail/fields/resent_bcc_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/resent_cc_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/resent_date_field_spec.rb +39 -0
- data/vendor/mail/spec/mail/fields/resent_from_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/resent_message_id_field_spec.rb +24 -0
- data/vendor/mail/spec/mail/fields/resent_sender_field_spec.rb +58 -0
- data/vendor/mail/spec/mail/fields/resent_to_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/return_path_field_spec.rb +52 -0
- data/vendor/mail/spec/mail/fields/sender_field_spec.rb +58 -0
- data/vendor/mail/spec/mail/fields/structured_field_spec.rb +72 -0
- data/vendor/mail/spec/mail/fields/to_field_spec.rb +92 -0
- data/vendor/mail/spec/mail/fields/unstructured_field_spec.rb +134 -0
- data/vendor/mail/spec/mail/header_spec.rb +578 -0
- data/vendor/mail/spec/mail/mail_spec.rb +34 -0
- data/vendor/mail/spec/mail/message_spec.rb +1409 -0
- data/vendor/mail/spec/mail/mime_messages_spec.rb +435 -0
- data/vendor/mail/spec/mail/multipart_report_spec.rb +112 -0
- data/vendor/mail/spec/mail/network/delivery_methods/file_delivery_spec.rb +79 -0
- data/vendor/mail/spec/mail/network/delivery_methods/sendmail_spec.rb +125 -0
- data/vendor/mail/spec/mail/network/delivery_methods/smtp_spec.rb +133 -0
- data/vendor/mail/spec/mail/network/delivery_methods/test_mailer_spec.rb +57 -0
- data/vendor/mail/spec/mail/network/retriever_methods/pop3_spec.rb +180 -0
- data/vendor/mail/spec/mail/network_spec.rb +359 -0
- data/vendor/mail/spec/mail/parsers/address_lists_parser_spec.rb +15 -0
- data/vendor/mail/spec/mail/parsers/content_transfer_encoding_parser_spec.rb +72 -0
- data/vendor/mail/spec/mail/part_spec.rb +129 -0
- data/vendor/mail/spec/mail/parts_list_spec.rb +12 -0
- data/vendor/mail/spec/mail/round_tripping_spec.rb +44 -0
- data/vendor/mail/spec/mail/utilities_spec.rb +327 -0
- data/vendor/mail/spec/mail/version_specific/escape_paren_1_8_spec.rb +32 -0
- data/vendor/mail/spec/matchers/break_down_to.rb +35 -0
- data/vendor/mail/spec/spec_helper.rb +163 -0
- metadata +442 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'mail/encodings/8bit'
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module Encodings
|
6
|
+
class SevenBit < EightBit
|
7
|
+
NAME = '7bit'
|
8
|
+
|
9
|
+
PRIORITY = 1
|
10
|
+
|
11
|
+
# 7bit and 8bit operate the same
|
12
|
+
|
13
|
+
# Decode the string
|
14
|
+
def self.decode(str)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# Encode the string
|
19
|
+
def self.encode(str)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
# Idenity encodings have a fixed cost, 1 byte out per 1 byte in
|
24
|
+
def self.cost(str)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
Encodings.register(NAME, self)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'mail/encodings/binary'
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module Encodings
|
6
|
+
class EightBit < Binary
|
7
|
+
NAME = '8bit'
|
8
|
+
|
9
|
+
PRIORITY = 4
|
10
|
+
|
11
|
+
# 8bit is an identiy encoding, meaning nothing to do
|
12
|
+
|
13
|
+
# Decode the string
|
14
|
+
def self.decode(str)
|
15
|
+
str.to_lf
|
16
|
+
end
|
17
|
+
|
18
|
+
# Encode the string
|
19
|
+
def self.encode(str)
|
20
|
+
str.to_crlf
|
21
|
+
end
|
22
|
+
|
23
|
+
# Idenity encodings have a fixed cost, 1 byte out per 1 byte in
|
24
|
+
def self.cost(str)
|
25
|
+
1.0
|
26
|
+
end
|
27
|
+
|
28
|
+
Encodings.register(NAME, self)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'mail/encodings/7bit'
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module Encodings
|
6
|
+
class Base64 < SevenBit
|
7
|
+
NAME = 'base64'
|
8
|
+
|
9
|
+
PRIORITY = 3
|
10
|
+
|
11
|
+
def self.can_encode?(enc)
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
# Decode the string from Base64
|
16
|
+
def self.decode(str)
|
17
|
+
RubyVer.decode_base64( str )
|
18
|
+
end
|
19
|
+
|
20
|
+
# Encode the string to Base64
|
21
|
+
def self.encode(str)
|
22
|
+
RubyVer.encode_base64( str ).to_crlf
|
23
|
+
end
|
24
|
+
|
25
|
+
# Base64 has a fixed cost, 4 bytes out per 3 bytes in
|
26
|
+
def self.cost(str)
|
27
|
+
4.0/3
|
28
|
+
end
|
29
|
+
|
30
|
+
Encodings.register(NAME, self)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'mail/encodings/transfer_encoding'
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module Encodings
|
6
|
+
class Binary < TransferEncoding
|
7
|
+
NAME = 'binary'
|
8
|
+
|
9
|
+
PRIORITY = 5
|
10
|
+
|
11
|
+
# Binary is an identiy encoding, meaning nothing to do
|
12
|
+
|
13
|
+
# Decode the string
|
14
|
+
def self.decode(str)
|
15
|
+
str
|
16
|
+
end
|
17
|
+
|
18
|
+
# Encode the string
|
19
|
+
def self.encode(str)
|
20
|
+
str
|
21
|
+
end
|
22
|
+
|
23
|
+
# Idenity encodings have a fixed cost, 1 byte out per 1 byte in
|
24
|
+
def self.cost(str)
|
25
|
+
1.0
|
26
|
+
end
|
27
|
+
|
28
|
+
Encodings.register(NAME, self)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'mail/encodings/7bit'
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module Encodings
|
6
|
+
class QuotedPrintable < SevenBit
|
7
|
+
NAME='quoted-printable'
|
8
|
+
|
9
|
+
PRIORITY = 2
|
10
|
+
|
11
|
+
def self.can_encode?(str)
|
12
|
+
EightBit.can_encode? str
|
13
|
+
end
|
14
|
+
|
15
|
+
# Decode the string from Quoted-Printable
|
16
|
+
def self.decode(str)
|
17
|
+
str.unpack("M*").first
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.encode(str)
|
21
|
+
[str].pack("M").gsub(/\n/, "\r\n")
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.cost(str)
|
25
|
+
# These bytes probably do not need encoding
|
26
|
+
c = str.count("\x9\xA\xD\x20-\x3C\x3E-\x7E")
|
27
|
+
# Everything else turns into =XX where XX is a
|
28
|
+
# two digit hex number (taking 3 bytes)
|
29
|
+
total = (str.bytesize - c)*3 + c
|
30
|
+
total.to_f/str.bytesize
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
Encodings.register(NAME, self)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Mail
|
3
|
+
module Encodings
|
4
|
+
class TransferEncoding
|
5
|
+
NAME = ''
|
6
|
+
|
7
|
+
PRIORITY = -1
|
8
|
+
|
9
|
+
def self.can_transport?(enc)
|
10
|
+
enc = Encodings.get_name(enc)
|
11
|
+
if Encodings.defined? enc
|
12
|
+
Encodings.get_encoding(enc).new.is_a? self
|
13
|
+
else
|
14
|
+
false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.can_encode?(enc)
|
19
|
+
can_transport? enc
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.cost(str)
|
23
|
+
raise "Unimplemented"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.to_s
|
27
|
+
self::NAME
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_best_compatible(source_encoding, str)
|
31
|
+
if self.can_transport? source_encoding then
|
32
|
+
source_encoding
|
33
|
+
else
|
34
|
+
choices = []
|
35
|
+
Encodings.get_all.each do |enc|
|
36
|
+
choices << enc if self.can_transport? enc and enc.can_encode? source_encoding
|
37
|
+
end
|
38
|
+
best = nil
|
39
|
+
best_cost = 100
|
40
|
+
choices.each do |enc|
|
41
|
+
this_cost = enc.cost str
|
42
|
+
if this_cost < best_cost then
|
43
|
+
best_cost = this_cost
|
44
|
+
best = enc
|
45
|
+
elsif this_cost == best_cost then
|
46
|
+
best = enc if enc::PRIORITY < best::PRIORITY
|
47
|
+
end
|
48
|
+
end
|
49
|
+
best
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_s
|
54
|
+
self.class.to_s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# = Mail Envelope
|
4
|
+
#
|
5
|
+
# The Envelope class provides a field for the first line in an
|
6
|
+
# mbox file, that looks like "From mikel@test.lindsaar.net DATETIME"
|
7
|
+
#
|
8
|
+
# This envelope class reads that line, and turns it into an
|
9
|
+
# Envelope.from and Envelope.date for your use.
|
10
|
+
module Mail
|
11
|
+
class Envelope < StructuredField
|
12
|
+
|
13
|
+
def initialize(*args)
|
14
|
+
super(FIELD_NAME, strip_field(FIELD_NAME, args.last))
|
15
|
+
end
|
16
|
+
|
17
|
+
def tree
|
18
|
+
@element ||= Mail::EnvelopeFromElement.new(value)
|
19
|
+
@tree ||= @element.tree
|
20
|
+
end
|
21
|
+
|
22
|
+
def element
|
23
|
+
@element ||= Mail::EnvelopeFromElement.new(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def date
|
27
|
+
::DateTime.parse("#{element.date_time}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def from
|
31
|
+
element.address
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
require 'mail/fields'
|
2
|
+
|
3
|
+
# encoding: utf-8
|
4
|
+
module Mail
|
5
|
+
# Provides a single class to call to create a new structured or unstructured
|
6
|
+
# field. Works out per RFC what field of field it is being given and returns
|
7
|
+
# the correct field of class back on new.
|
8
|
+
#
|
9
|
+
# ===Per RFC 2822
|
10
|
+
#
|
11
|
+
# 2.2. Header Fields
|
12
|
+
#
|
13
|
+
# Header fields are lines composed of a field name, followed by a colon
|
14
|
+
# (":"), followed by a field body, and terminated by CRLF. A field
|
15
|
+
# name MUST be composed of printable US-ASCII characters (i.e.,
|
16
|
+
# characters that have values between 33 and 126, inclusive), except
|
17
|
+
# colon. A field body may be composed of any US-ASCII characters,
|
18
|
+
# except for CR and LF. However, a field body may contain CRLF when
|
19
|
+
# used in header "folding" and "unfolding" as described in section
|
20
|
+
# 2.2.3. All field bodies MUST conform to the syntax described in
|
21
|
+
# sections 3 and 4 of this standard.
|
22
|
+
#
|
23
|
+
class Field
|
24
|
+
|
25
|
+
include Patterns
|
26
|
+
include Comparable
|
27
|
+
|
28
|
+
STRUCTURED_FIELDS = %w[ bcc cc content-description content-disposition
|
29
|
+
content-id content-location content-transfer-encoding
|
30
|
+
content-type date from in-reply-to keywords message-id
|
31
|
+
mime-version received references reply-to
|
32
|
+
resent-bcc resent-cc resent-date resent-from
|
33
|
+
resent-message-id resent-sender resent-to
|
34
|
+
return-path sender to ]
|
35
|
+
|
36
|
+
KNOWN_FIELDS = STRUCTURED_FIELDS + ['comments', 'subject']
|
37
|
+
|
38
|
+
# Generic Field Exception
|
39
|
+
class FieldError < StandardError
|
40
|
+
end
|
41
|
+
|
42
|
+
# Raised when a parsing error has occurred (ie, a StructuredField has tried
|
43
|
+
# to parse a field that is invalid or improperly written)
|
44
|
+
class ParseError < FieldError #:nodoc:
|
45
|
+
end
|
46
|
+
|
47
|
+
# Raised when attempting to set a structured field's contents to an invalid syntax
|
48
|
+
class SyntaxError < FieldError #:nodoc:
|
49
|
+
end
|
50
|
+
|
51
|
+
# Accepts a string:
|
52
|
+
#
|
53
|
+
# Field.new("field-name: field data")
|
54
|
+
#
|
55
|
+
# Or name, value pair:
|
56
|
+
#
|
57
|
+
# Field.new("field-name", "value")
|
58
|
+
#
|
59
|
+
# Or a name by itself:
|
60
|
+
#
|
61
|
+
# Field.new("field-name")
|
62
|
+
#
|
63
|
+
# Note, does not want a terminating carriage return. Returns
|
64
|
+
# self appropriately parsed. If value is not a string, then
|
65
|
+
# it will be passed through as is, for example, content-type
|
66
|
+
# field can accept an array with the type and a hash of
|
67
|
+
# parameters:
|
68
|
+
#
|
69
|
+
# Field.new('content-type', ['text', 'plain', {:charset => 'UTF-8'}])
|
70
|
+
def initialize(name, value = nil, charset = 'utf-8')
|
71
|
+
case
|
72
|
+
when name =~ /:/ && value.blank? # Field.new("field-name: field data")
|
73
|
+
name, value = split(name)
|
74
|
+
create_field(name, value, charset)
|
75
|
+
when name !~ /:/ && value.blank? # Field.new("field-name")
|
76
|
+
create_field(name, nil, charset)
|
77
|
+
else # Field.new("field-name", "value")
|
78
|
+
create_field(name, value, charset)
|
79
|
+
end
|
80
|
+
return self
|
81
|
+
end
|
82
|
+
|
83
|
+
def field=(value)
|
84
|
+
@field = value
|
85
|
+
end
|
86
|
+
|
87
|
+
def field
|
88
|
+
@field
|
89
|
+
end
|
90
|
+
|
91
|
+
def name
|
92
|
+
field.name
|
93
|
+
end
|
94
|
+
|
95
|
+
def value
|
96
|
+
field.value
|
97
|
+
end
|
98
|
+
|
99
|
+
def value=(val)
|
100
|
+
create_field(name, val, charset)
|
101
|
+
end
|
102
|
+
|
103
|
+
def to_s
|
104
|
+
field.to_s
|
105
|
+
end
|
106
|
+
|
107
|
+
def update(name, value)
|
108
|
+
create_field(name, value, charset)
|
109
|
+
end
|
110
|
+
|
111
|
+
def same( other )
|
112
|
+
match_to_s(other.name, field.name)
|
113
|
+
end
|
114
|
+
|
115
|
+
def <=>( other )
|
116
|
+
self_order = FIELD_ORDER.rindex(self.name.to_s.downcase) || 100
|
117
|
+
other_order = FIELD_ORDER.rindex(other.name.to_s.downcase) || 100
|
118
|
+
self_order <=> other_order
|
119
|
+
end
|
120
|
+
|
121
|
+
def method_missing(name, *args, &block)
|
122
|
+
field.send(name, *args, &block)
|
123
|
+
end
|
124
|
+
|
125
|
+
FIELD_ORDER = %w[ return-path received
|
126
|
+
resent-date resent-from resent-sender resent-to
|
127
|
+
resent-cc resent-bcc resent-message-id
|
128
|
+
date from sender reply-to to cc bcc
|
129
|
+
message-id in-reply-to references
|
130
|
+
subject comments keywords
|
131
|
+
mime-version content-type content-transfer-encoding
|
132
|
+
content-location content-disposition content-description ]
|
133
|
+
|
134
|
+
private
|
135
|
+
|
136
|
+
def split(raw_field)
|
137
|
+
match_data = raw_field.match(/^(#{FIELD_NAME})\s*:\s*(#{FIELD_BODY})?$/u)
|
138
|
+
[match_data[1].to_s.strip, match_data[2].to_s.strip]
|
139
|
+
rescue
|
140
|
+
STDERR.puts "WARNING: Could not parse (and so ignorning) '#{raw_field}'"
|
141
|
+
end
|
142
|
+
|
143
|
+
def create_field(name, value, charset)
|
144
|
+
begin
|
145
|
+
self.field = new_field(name, value, charset)
|
146
|
+
rescue Mail::Field::ParseError => e
|
147
|
+
self.field = Mail::UnstructuredField.new(name, value)
|
148
|
+
self.field.errors << [name, value, e]
|
149
|
+
self.field
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def new_field(name, value, charset)
|
154
|
+
# Could do this with constantize and make it "as DRY as", but a simple case
|
155
|
+
# statement is, well, simpler...
|
156
|
+
case name.to_s.downcase
|
157
|
+
when /^to$/i
|
158
|
+
ToField.new(value, charset)
|
159
|
+
when /^cc$/i
|
160
|
+
CcField.new(value, charset)
|
161
|
+
when /^bcc$/i
|
162
|
+
BccField.new(value, charset)
|
163
|
+
when /^message-id$/i
|
164
|
+
MessageIdField.new(value, charset)
|
165
|
+
when /^in-reply-to$/i
|
166
|
+
InReplyToField.new(value, charset)
|
167
|
+
when /^references$/i
|
168
|
+
ReferencesField.new(value, charset)
|
169
|
+
when /^subject$/i
|
170
|
+
SubjectField.new(value, charset)
|
171
|
+
when /^comments$/i
|
172
|
+
CommentsField.new(value, charset)
|
173
|
+
when /^keywords$/i
|
174
|
+
KeywordsField.new(value, charset)
|
175
|
+
when /^date$/i
|
176
|
+
DateField.new(value, charset)
|
177
|
+
when /^from$/i
|
178
|
+
FromField.new(value, charset)
|
179
|
+
when /^sender$/i
|
180
|
+
SenderField.new(value, charset)
|
181
|
+
when /^reply-to$/i
|
182
|
+
ReplyToField.new(value, charset)
|
183
|
+
when /^resent-date$/i
|
184
|
+
ResentDateField.new(value, charset)
|
185
|
+
when /^resent-from$/i
|
186
|
+
ResentFromField.new(value, charset)
|
187
|
+
when /^resent-sender$/i
|
188
|
+
ResentSenderField.new(value, charset)
|
189
|
+
when /^resent-to$/i
|
190
|
+
ResentToField.new(value, charset)
|
191
|
+
when /^resent-cc$/i
|
192
|
+
ResentCcField.new(value, charset)
|
193
|
+
when /^resent-bcc$/i
|
194
|
+
ResentBccField.new(value, charset)
|
195
|
+
when /^resent-message-id$/i
|
196
|
+
ResentMessageIdField.new(value, charset)
|
197
|
+
when /^return-path$/i
|
198
|
+
ReturnPathField.new(value, charset)
|
199
|
+
when /^received$/i
|
200
|
+
ReceivedField.new(value, charset)
|
201
|
+
when /^mime-version$/i
|
202
|
+
MimeVersionField.new(value, charset)
|
203
|
+
when /^content-transfer-encoding$/i
|
204
|
+
ContentTransferEncodingField.new(value, charset)
|
205
|
+
when /^content-description$/i
|
206
|
+
ContentDescriptionField.new(value, charset)
|
207
|
+
when /^content-disposition$/i
|
208
|
+
ContentDispositionField.new(value, charset)
|
209
|
+
when /^content-type$/i
|
210
|
+
ContentTypeField.new(value, charset)
|
211
|
+
when /^content-id$/i
|
212
|
+
ContentIdField.new(value, charset)
|
213
|
+
when /^content-location$/i
|
214
|
+
ContentLocationField.new(value, charset)
|
215
|
+
else
|
216
|
+
OptionalField.new(name, value, charset)
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|