rack-mail_exception 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,359 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
class MyDelivery; def initialize(settings); end; end
|
5
|
+
|
6
|
+
class MyRetriever; def initialize(settings); end; end
|
7
|
+
|
8
|
+
describe "Mail" do
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
# Reset all defaults back to original state
|
12
|
+
Mail.defaults do
|
13
|
+
delivery_method :smtp, { :address => "localhost",
|
14
|
+
:port => 25,
|
15
|
+
:domain => 'localhost.localdomain',
|
16
|
+
:user_name => nil,
|
17
|
+
:password => nil,
|
18
|
+
:authentication => nil,
|
19
|
+
:enable_starttls_auto => true }
|
20
|
+
|
21
|
+
retriever_method :pop3, { :address => "localhost",
|
22
|
+
:port => 110,
|
23
|
+
:user_name => nil,
|
24
|
+
:password => nil,
|
25
|
+
:enable_ssl => true }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "default delivery and retriever methods" do
|
30
|
+
|
31
|
+
it "should set the delivery method" do
|
32
|
+
Mail.defaults do
|
33
|
+
delivery_method :smtp
|
34
|
+
end
|
35
|
+
Mail.delivery_method.class.should == Mail::SMTP
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should default to settings for smtp" do
|
39
|
+
Mail.delivery_method.class.should == Mail::SMTP
|
40
|
+
Mail.delivery_method.settings.should == { :address => "localhost",
|
41
|
+
:port => 25,
|
42
|
+
:domain => 'localhost.localdomain',
|
43
|
+
:user_name => nil,
|
44
|
+
:password => nil,
|
45
|
+
:authentication => nil,
|
46
|
+
:enable_starttls_auto => true }
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should set the retriever method" do
|
50
|
+
Mail.defaults do
|
51
|
+
retriever_method :pop3
|
52
|
+
end
|
53
|
+
Mail.retriever_method.class.should == Mail::POP3
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should default to settings for pop3" do
|
57
|
+
Mail.retriever_method.class.should == Mail::POP3
|
58
|
+
Mail.retriever_method.settings.should == { :address => "localhost",
|
59
|
+
:port => 110,
|
60
|
+
:user_name => nil,
|
61
|
+
:password => nil,
|
62
|
+
:authentication => nil,
|
63
|
+
:enable_ssl => true }
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should allow us to overwrite anything we need on SMTP" do
|
67
|
+
Mail.defaults do
|
68
|
+
delivery_method :smtp, :port => 999
|
69
|
+
end
|
70
|
+
Mail.delivery_method.settings[:address].should == 'localhost'
|
71
|
+
Mail.delivery_method.settings[:port].should == 999
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should allow us to overwrite anything we need on POP3" do
|
75
|
+
Mail.defaults do
|
76
|
+
retriever_method :pop3, :address => 'foo.bar.com'
|
77
|
+
end
|
78
|
+
Mail.retriever_method.settings[:address].should == 'foo.bar.com'
|
79
|
+
Mail.retriever_method.settings[:port].should == 110
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should allow you to pass in your own delivery method" do
|
83
|
+
Mail.defaults do
|
84
|
+
delivery_method MyDelivery
|
85
|
+
end
|
86
|
+
Mail.delivery_method.class.should == MyDelivery
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should ask the custom delivery agent for it's settings" do
|
90
|
+
mock_my_delivery = mock(MyDelivery)
|
91
|
+
mock_my_delivery.should_receive(:settings).and_return({:these_are => :settings})
|
92
|
+
MyDelivery.should_receive(:new).and_return(mock_my_delivery)
|
93
|
+
Mail.defaults do
|
94
|
+
delivery_method MyDelivery
|
95
|
+
end
|
96
|
+
Mail.delivery_method.settings.should == {:these_are => :settings}
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should allow you to pass in your own retriever method" do
|
100
|
+
Mail.defaults do
|
101
|
+
retriever_method MyRetriever
|
102
|
+
end
|
103
|
+
Mail.retriever_method.class.should == MyRetriever
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should ask the custom retriever agent for it's settings" do
|
107
|
+
mock_my_retriever = mock(MyRetriever)
|
108
|
+
mock_my_retriever.should_receive(:settings).and_return({:these_are => :settings})
|
109
|
+
MyRetriever.should_receive(:new).and_return(mock_my_retriever)
|
110
|
+
Mail.defaults do
|
111
|
+
retriever_method MyRetriever
|
112
|
+
end
|
113
|
+
Mail.retriever_method.settings.should == {:these_are => :settings}
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "instance delivery methods" do
|
119
|
+
|
120
|
+
it "should copy the defaults defined by Mail.defaults" do
|
121
|
+
mail = Mail.new
|
122
|
+
mail.delivery_method.class.should == Mail::SMTP
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should be able to change the delivery_method" do
|
126
|
+
mail = Mail.new
|
127
|
+
mail.delivery_method :file
|
128
|
+
mail.delivery_method.class.should == Mail::FileDelivery
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should be able to change the delivery_method and pass in settings" do
|
132
|
+
mail = Mail.new
|
133
|
+
tmpdir = File.expand_path('../../../tmp/mail', __FILE__)
|
134
|
+
mail.delivery_method :file, :location => tmpdir
|
135
|
+
mail.delivery_method.class.should == Mail::FileDelivery
|
136
|
+
mail.delivery_method.settings.should == {:location => tmpdir}
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should not change the default when it changes the delivery_method" do
|
140
|
+
mail1 = Mail.new
|
141
|
+
mail2 = Mail.new
|
142
|
+
mail1.delivery_method :file
|
143
|
+
Mail.delivery_method.class.should == Mail::SMTP
|
144
|
+
mail1.delivery_method.class.should == Mail::FileDelivery
|
145
|
+
mail2.delivery_method.class.should == Mail::SMTP
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should not change the default settings when it changes the delivery_method settings" do
|
149
|
+
mail1 = Mail.new
|
150
|
+
mail2 = Mail.new
|
151
|
+
mail1.delivery_method :smtp, :address => 'my.own.address'
|
152
|
+
Mail.delivery_method.settings[:address].should == 'localhost'
|
153
|
+
mail1.delivery_method.settings[:address].should == 'my.own.address'
|
154
|
+
mail2.delivery_method.settings[:address].should == 'localhost'
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "retrieving emails via POP3" do
|
160
|
+
it "should retrieve all emails via POP3" do
|
161
|
+
messages = Mail.all
|
162
|
+
|
163
|
+
messages.should_not be_empty
|
164
|
+
for message in messages
|
165
|
+
message.should be_instance_of(Mail::Message)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "sending emails via SMTP" do
|
171
|
+
|
172
|
+
before(:each) do
|
173
|
+
# Set the delivery method to test as the default
|
174
|
+
MockSMTP.clear_deliveries
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should deliver a mail message" do
|
178
|
+
message = Mail.deliver do
|
179
|
+
from 'mikel@test.lindsaar.net'
|
180
|
+
to 'ada@test.lindsaar.net'
|
181
|
+
subject 'Re: No way!'
|
182
|
+
body 'Yeah sure'
|
183
|
+
# add_file 'New Header Image', '/somefile.png'
|
184
|
+
end
|
185
|
+
|
186
|
+
MockSMTP.deliveries[0][0].should == message.encoded
|
187
|
+
MockSMTP.deliveries[0][1].should == "mikel@test.lindsaar.net"
|
188
|
+
MockSMTP.deliveries[0][2].should == ["ada@test.lindsaar.net"]
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should deliver itself" do
|
192
|
+
message = Mail.new do
|
193
|
+
from 'mikel@test.lindsaar.net'
|
194
|
+
to 'ada@test.lindsaar.net'
|
195
|
+
subject 'Re: No way!'
|
196
|
+
body 'Yeah sure'
|
197
|
+
# add_file 'New Header Image', '/somefile.png'
|
198
|
+
end
|
199
|
+
|
200
|
+
message.deliver!
|
201
|
+
|
202
|
+
MockSMTP.deliveries[0][0].should == message.encoded
|
203
|
+
MockSMTP.deliveries[0][1].should == "mikel@test.lindsaar.net"
|
204
|
+
MockSMTP.deliveries[0][2].should == ["ada@test.lindsaar.net"]
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
describe "deliveries" do
|
210
|
+
|
211
|
+
class MyDeliveryMethod
|
212
|
+
attr_accessor :settings
|
213
|
+
def initialize(values = {}); end
|
214
|
+
def deliver!(message); true; end
|
215
|
+
end
|
216
|
+
|
217
|
+
class MyObserver
|
218
|
+
def self.delivered_email(message); end
|
219
|
+
end
|
220
|
+
|
221
|
+
class MyDeliveryHandler
|
222
|
+
def deliver_mail(mail)
|
223
|
+
yield
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
class MyYieldingDeliveryHandler
|
228
|
+
def deliver_mail(mail)
|
229
|
+
yield
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
before(:each) do
|
234
|
+
@message = Mail.new do
|
235
|
+
from 'mikel@test.lindsaar.net'
|
236
|
+
to 'ada@test.lindsaar.net'
|
237
|
+
subject 'Re: No way!'
|
238
|
+
body 'Yeah sure'
|
239
|
+
end
|
240
|
+
@message.delivery_method :test
|
241
|
+
end
|
242
|
+
|
243
|
+
describe "adding to Mail.deliveries" do
|
244
|
+
it "should add itself to the deliveries collection on mail on delivery" do
|
245
|
+
doing { @message.deliver }.should change(Mail::TestMailer.deliveries, :size).by(1)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "perform_deliveries" do
|
250
|
+
it "should call deliver! on the delivery method by default" do
|
251
|
+
delivery_agent = MyDeliveryMethod.new
|
252
|
+
@message.should_receive(:delivery_method).and_return(delivery_agent)
|
253
|
+
delivery_agent.should_receive(:deliver!).with(@message)
|
254
|
+
@message.deliver
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should not call deliver if perform deliveries is set to false" do
|
258
|
+
@message.perform_deliveries = false
|
259
|
+
delivery_agent = MyDeliveryMethod.new
|
260
|
+
@message.should_not_receive(:delivery_method).and_return(delivery_agent)
|
261
|
+
delivery_agent.should_not_receive(:deliver!)
|
262
|
+
@message.deliver
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should add to the deliveries array if perform_deliveries is true" do
|
266
|
+
@message.perform_deliveries = true
|
267
|
+
doing { @message.deliver }.should change(Mail::TestMailer.deliveries, :size).by(1)
|
268
|
+
end
|
269
|
+
|
270
|
+
it "should not add to the deliveries array if perform_deliveries is false" do
|
271
|
+
@message.perform_deliveries = false
|
272
|
+
doing { @message.deliver }.should_not change(Mail::TestMailer.deliveries, :size)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
describe "observers" do
|
277
|
+
it "should tell it's observers that it was told to deliver an email" do
|
278
|
+
Mail.register_observer(MyObserver)
|
279
|
+
MyObserver.should_receive(:delivered_email).with(@message).once
|
280
|
+
@message.deliver
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should tell it's observers that it was told to deliver an email even if perform_deliveries is false" do
|
284
|
+
Mail.register_observer(MyObserver)
|
285
|
+
@message.perform_deliveries = false
|
286
|
+
MyObserver.should_receive(:delivered_email).with(@message).once
|
287
|
+
@message.deliver
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should tell it's observers that it was told to deliver an email even if it is using a delivery_handler" do
|
291
|
+
Mail.register_observer(MyObserver)
|
292
|
+
@message.delivery_handler = MyDeliveryHandler.new
|
293
|
+
@message.perform_deliveries = false
|
294
|
+
MyObserver.should_receive(:delivered_email).with(@message).once
|
295
|
+
@message.deliver
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
describe "raise_delivery_errors" do
|
301
|
+
it "should pass on delivery errors if raised" do
|
302
|
+
delivery_agent = MyDeliveryMethod.new
|
303
|
+
@message.stub!(:delivery_method).and_return(delivery_agent)
|
304
|
+
delivery_agent.stub!(:deliver!).and_raise(Exception)
|
305
|
+
doing { @message.deliver }.should raise_error(Exception)
|
306
|
+
end
|
307
|
+
|
308
|
+
it "should not pass on delivery errors if raised raise_delivery_errors is set to false" do
|
309
|
+
delivery_agent = MyDeliveryMethod.new
|
310
|
+
@message.stub!(:delivery_method).and_return(delivery_agent)
|
311
|
+
@message.raise_delivery_errors = false
|
312
|
+
delivery_agent.stub!(:deliver!).and_raise(Exception)
|
313
|
+
doing { @message.deliver }.should_not raise_error(Exception)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
describe "delivery_handler" do
|
318
|
+
|
319
|
+
it "should allow you to hand off performing the actual delivery to another object" do
|
320
|
+
delivery_handler = MyDeliveryHandler.new
|
321
|
+
delivery_handler.should_receive(:deliver_mail).with(@message).exactly(:once)
|
322
|
+
@message.delivery_handler = delivery_handler
|
323
|
+
@message.deliver
|
324
|
+
end
|
325
|
+
|
326
|
+
it "mail should be told to :deliver once and then :deliver! once by the delivery handler" do
|
327
|
+
@message.delivery_handler = MyDeliveryHandler.new
|
328
|
+
@message.should_receive(:do_delivery).exactly(:once)
|
329
|
+
@message.deliver
|
330
|
+
end
|
331
|
+
|
332
|
+
it "mail only call it's delivery_method once" do
|
333
|
+
@message.delivery_handler = MyDeliveryHandler.new
|
334
|
+
@message.should_receive(:delivery_method).exactly(:once).and_return(Mail::TestMailer.new({}))
|
335
|
+
@message.deliver
|
336
|
+
end
|
337
|
+
|
338
|
+
it "mail should not catch any exceptions when using a delivery_handler" do
|
339
|
+
@message.delivery_handler = MyDeliveryHandler.new
|
340
|
+
@message.should_receive(:delivery_method).and_raise(Exception)
|
341
|
+
doing { @message.deliver }.should raise_error(Exception)
|
342
|
+
end
|
343
|
+
|
344
|
+
it "mail should not modify the Mail.deliveries object if using a delivery_handler" do
|
345
|
+
@message.delivery_handler = MyDeliveryHandler.new
|
346
|
+
doing { @message.deliver }.should_not change(Mail::TestMailer, :deliveries)
|
347
|
+
end
|
348
|
+
|
349
|
+
it "should be able to just yield and let mail do it's thing" do
|
350
|
+
@message.delivery_handler = MyYieldingDeliveryHandler.new
|
351
|
+
@message.should_receive(:do_delivery).exactly(:once)
|
352
|
+
@message.deliver
|
353
|
+
end
|
354
|
+
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
358
|
+
|
359
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'treetop/compiler'
|
5
|
+
Treetop.load(File.join(MAIL_ROOT, 'lib/mail/parsers/rfc2822_obsolete'))
|
6
|
+
Treetop.load(File.join(MAIL_ROOT, 'lib/mail/parsers/rfc2822'))
|
7
|
+
Treetop.load(File.join(MAIL_ROOT, 'lib/mail/parsers/address_lists'))
|
8
|
+
|
9
|
+
describe "AddressListsParser" do
|
10
|
+
it "should parse an address" do
|
11
|
+
text = 'Mikel Lindsaar <test@lindsaar.net>, Friends: test2@lindsaar.net, Ada <test3@lindsaar.net>;'
|
12
|
+
a = Mail::AddressListsParser.new
|
13
|
+
a.parse(text).should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
Treetop.load(File.join(MAIL_ROOT, 'lib/mail/parsers/rfc2822_obsolete'))
|
5
|
+
Treetop.load(File.join(MAIL_ROOT, 'lib/mail/parsers/rfc2822'))
|
6
|
+
Treetop.load(File.join(MAIL_ROOT, 'lib/mail/parsers/content_transfer_encoding'))
|
7
|
+
|
8
|
+
describe "ContentTransferEncodingParser" do
|
9
|
+
|
10
|
+
it "should work" do
|
11
|
+
text = "quoted-printable"
|
12
|
+
a = Mail::ContentTransferEncodingParser.new
|
13
|
+
a.parse(text).should_not be_nil
|
14
|
+
a.parse(text).encoding.text_value.should == 'quoted-printable'
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "trailing semi colons" do
|
18
|
+
|
19
|
+
it "should parse" do
|
20
|
+
text = "quoted-printable;"
|
21
|
+
a = Mail::ContentTransferEncodingParser.new
|
22
|
+
a.parse(text).should_not be_nil
|
23
|
+
a.parse(text).encoding.text_value.should == 'quoted-printable'
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should parse with pre white space" do
|
27
|
+
text = 'quoted-printable ;'
|
28
|
+
a = Mail::ContentTransferEncodingParser.new
|
29
|
+
a.parse(text).should_not be_nil
|
30
|
+
a.parse(text).encoding.text_value.should == 'quoted-printable'
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should parse with trailing white space" do
|
34
|
+
text = 'quoted-printable; '
|
35
|
+
a = Mail::ContentTransferEncodingParser.new
|
36
|
+
a.parse(text).should_not be_nil
|
37
|
+
a.parse(text).encoding.text_value.should == 'quoted-printable'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should parse with pre and trailing white space" do
|
41
|
+
text = 'quoted-printable ; '
|
42
|
+
a = Mail::ContentTransferEncodingParser.new
|
43
|
+
a.parse(text).should_not be_nil
|
44
|
+
a.parse(text).encoding.text_value.should == 'quoted-printable'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "x-token values" do
|
49
|
+
it "should work" do
|
50
|
+
text = 'x-my-token'
|
51
|
+
a = Mail::ContentTransferEncodingParser.new
|
52
|
+
a.parse(text).should_not be_nil
|
53
|
+
a.parse(text).encoding.text_value.should == 'x-my-token'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "wild content-transfer-encoding" do
|
58
|
+
it "should convert 8bits to 8bit" do
|
59
|
+
text = '8bits'
|
60
|
+
a = Mail::ContentTransferEncodingParser.new
|
61
|
+
a.parse(text).should_not be_nil
|
62
|
+
a.parse(text).encoding.text_value.should == '8bit'
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should convert 7bits to 7bit" do
|
66
|
+
text = '7bits'
|
67
|
+
a = Mail::ContentTransferEncodingParser.new
|
68
|
+
a.parse(text).should_not be_nil
|
69
|
+
a.parse(text).encoding.text_value.should == '7bit'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mail::Part do
|
4
|
+
|
5
|
+
it "should put content-ids into parts" do
|
6
|
+
part = Mail::Part.new do
|
7
|
+
body "This is Text"
|
8
|
+
end
|
9
|
+
part.to_s
|
10
|
+
part.content_id.should_not be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should preserve any content id that you put into it" do
|
14
|
+
part = Mail::Part.new do
|
15
|
+
content_id "<thisis@acontentid>"
|
16
|
+
body "This is Text"
|
17
|
+
end
|
18
|
+
part.content_id.should == "<thisis@acontentid>"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return an inline content_id" do
|
22
|
+
part = Mail::Part.new do
|
23
|
+
content_id "<thisis@acontentid>"
|
24
|
+
body "This is Text"
|
25
|
+
end
|
26
|
+
part.inline_content_id.should == "thisis@acontentid"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should URL escape its inline content_id" do
|
30
|
+
part = Mail::Part.new do
|
31
|
+
content_id "<thi%%sis@acontentid>"
|
32
|
+
body "This is Text"
|
33
|
+
end
|
34
|
+
part.inline_content_id.should == "thi%25%25sis@acontentid"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should add a content_id if there is none and is asked for an inline_content_id" do
|
38
|
+
part = Mail::Part.new
|
39
|
+
part.inline_content_id.should_not be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "parts that have a missing header" do
|
43
|
+
it "should not try to init a header if there is none" do
|
44
|
+
part =<<PARTEND
|
45
|
+
|
46
|
+
The original message was received at Mon, 24 Dec 2007 10:03:47 +1100
|
47
|
+
from 60-0-0-146.static.tttttt.com.au [60.0.0.146]
|
48
|
+
|
49
|
+
This message was generated by mail12.tttttt.com.au
|
50
|
+
|
51
|
+
----- The following addresses had permanent fatal errors -----
|
52
|
+
<edwin@zzzzzzz.com>
|
53
|
+
(reason: 553 5.3.0 <edwin@zzzzzzz.com>... Unknown E-Mail Address)
|
54
|
+
|
55
|
+
----- Transcript of session follows -----
|
56
|
+
... while talking to mail.zzzzzz.com.:
|
57
|
+
>>> DATA
|
58
|
+
<<< 553 5.3.0 <edwin@zzzzzzz.com>... Unknown E-Mail Address
|
59
|
+
550 5.1.1 <edwin@zzzzzzz.com>... User unknown
|
60
|
+
<<< 503 5.0.0 Need RCPT (recipient)
|
61
|
+
|
62
|
+
--
|
63
|
+
This message has been scanned for viruses and
|
64
|
+
dangerous content by MailScanner, and is
|
65
|
+
believed to be clean.
|
66
|
+
PARTEND
|
67
|
+
STDERR.should_not_receive(:puts)
|
68
|
+
Mail::Part.new(part)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "delivery status reports" do
|
73
|
+
before(:each) do
|
74
|
+
part =<<ENDPART
|
75
|
+
Content-Type: message/delivery-status
|
76
|
+
|
77
|
+
Reporting-MTA: dns; mail12.rrrr.com.au
|
78
|
+
Received-From-MTA: DNS; 60-0-0-146.static.tttttt.com.au
|
79
|
+
Arrival-Date: Mon, 24 Dec 2007 10:03:47 +1100
|
80
|
+
|
81
|
+
Final-Recipient: RFC822; edwin@zzzzzzz.com
|
82
|
+
Action: failed
|
83
|
+
Status: 5.3.0
|
84
|
+
Remote-MTA: DNS; mail.zzzzzz.com
|
85
|
+
Diagnostic-Code: SMTP; 553 5.3.0 <edwin@zzzzzzz.com>... Unknown E-Mail Address
|
86
|
+
Last-Attempt-Date: Mon, 24 Dec 2007 10:03:53 +1100
|
87
|
+
ENDPART
|
88
|
+
@delivery_report = Mail::Part.new(part)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should know if it is a delivery-status report" do
|
92
|
+
@delivery_report.should be_delivery_status_report_part
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should create a delivery_status_data header object" do
|
96
|
+
@delivery_report.delivery_status_data.should_not be_nil
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should be bounced" do
|
100
|
+
@delivery_report.should be_bounced
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should say action 'delayed'" do
|
104
|
+
@delivery_report.action.should == 'failed'
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should give a final recipient" do
|
108
|
+
@delivery_report.final_recipient.should == 'RFC822; edwin@zzzzzzz.com'
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should give an error code" do
|
112
|
+
@delivery_report.error_status.should == '5.3.0'
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should give a diagostic code" do
|
116
|
+
@delivery_report.diagnostic_code.should == 'SMTP; 553 5.3.0 <edwin@zzzzzzz.com>... Unknown E-Mail Address'
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should give a remote-mta" do
|
120
|
+
@delivery_report.remote_mta.should == 'DNS; mail.zzzzzz.com'
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should be retryable" do
|
124
|
+
@delivery_report.should_not be_retryable
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|