rack-mail_exception 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (321) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +38 -0
  5. data/Rakefile +56 -0
  6. data/VERSION +1 -0
  7. data/lib/rack/mail_exception.rb +103 -0
  8. data/test/helper.rb +13 -0
  9. data/test/test_rack_mail_exception.rb +93 -0
  10. data/vendor/mail/.bundle/config +2 -0
  11. data/vendor/mail/CHANGELOG.rdoc +370 -0
  12. data/vendor/mail/Dependencies.txt +3 -0
  13. data/vendor/mail/Gemfile +17 -0
  14. data/vendor/mail/README.rdoc +572 -0
  15. data/vendor/mail/ROADMAP +92 -0
  16. data/vendor/mail/Rakefile +41 -0
  17. data/vendor/mail/TODO.rdoc +9 -0
  18. data/vendor/mail/lib/mail.rb +76 -0
  19. data/vendor/mail/lib/mail/attachments_list.rb +99 -0
  20. data/vendor/mail/lib/mail/body.rb +287 -0
  21. data/vendor/mail/lib/mail/configuration.rb +67 -0
  22. data/vendor/mail/lib/mail/core_extensions/blank.rb +26 -0
  23. data/vendor/mail/lib/mail/core_extensions/nil.rb +11 -0
  24. data/vendor/mail/lib/mail/core_extensions/string.rb +27 -0
  25. data/vendor/mail/lib/mail/elements.rb +14 -0
  26. data/vendor/mail/lib/mail/elements/address.rb +306 -0
  27. data/vendor/mail/lib/mail/elements/address_list.rb +74 -0
  28. data/vendor/mail/lib/mail/elements/content_disposition_element.rb +30 -0
  29. data/vendor/mail/lib/mail/elements/content_location_element.rb +25 -0
  30. data/vendor/mail/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
  31. data/vendor/mail/lib/mail/elements/content_type_element.rb +35 -0
  32. data/vendor/mail/lib/mail/elements/date_time_element.rb +26 -0
  33. data/vendor/mail/lib/mail/elements/envelope_from_element.rb +34 -0
  34. data/vendor/mail/lib/mail/elements/message_ids_element.rb +29 -0
  35. data/vendor/mail/lib/mail/elements/mime_version_element.rb +26 -0
  36. data/vendor/mail/lib/mail/elements/phrase_list.rb +21 -0
  37. data/vendor/mail/lib/mail/elements/received_element.rb +30 -0
  38. data/vendor/mail/lib/mail/encodings.rb +258 -0
  39. data/vendor/mail/lib/mail/encodings/7bit.rb +31 -0
  40. data/vendor/mail/lib/mail/encodings/8bit.rb +31 -0
  41. data/vendor/mail/lib/mail/encodings/base64.rb +33 -0
  42. data/vendor/mail/lib/mail/encodings/binary.rb +31 -0
  43. data/vendor/mail/lib/mail/encodings/quoted_printable.rb +38 -0
  44. data/vendor/mail/lib/mail/encodings/transfer_encoding.rb +58 -0
  45. data/vendor/mail/lib/mail/envelope.rb +35 -0
  46. data/vendor/mail/lib/mail/field.rb +223 -0
  47. data/vendor/mail/lib/mail/field_list.rb +33 -0
  48. data/vendor/mail/lib/mail/fields.rb +35 -0
  49. data/vendor/mail/lib/mail/fields/bcc_field.rb +56 -0
  50. data/vendor/mail/lib/mail/fields/cc_field.rb +55 -0
  51. data/vendor/mail/lib/mail/fields/comments_field.rb +41 -0
  52. data/vendor/mail/lib/mail/fields/common/address_container.rb +16 -0
  53. data/vendor/mail/lib/mail/fields/common/common_address.rb +125 -0
  54. data/vendor/mail/lib/mail/fields/common/common_date.rb +42 -0
  55. data/vendor/mail/lib/mail/fields/common/common_field.rb +50 -0
  56. data/vendor/mail/lib/mail/fields/common/common_message_id.rb +43 -0
  57. data/vendor/mail/lib/mail/fields/common/parameter_hash.rb +52 -0
  58. data/vendor/mail/lib/mail/fields/content_description_field.rb +19 -0
  59. data/vendor/mail/lib/mail/fields/content_disposition_field.rb +69 -0
  60. data/vendor/mail/lib/mail/fields/content_id_field.rb +63 -0
  61. data/vendor/mail/lib/mail/fields/content_location_field.rb +42 -0
  62. data/vendor/mail/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
  63. data/vendor/mail/lib/mail/fields/content_type_field.rb +185 -0
  64. data/vendor/mail/lib/mail/fields/date_field.rb +55 -0
  65. data/vendor/mail/lib/mail/fields/from_field.rb +55 -0
  66. data/vendor/mail/lib/mail/fields/in_reply_to_field.rb +55 -0
  67. data/vendor/mail/lib/mail/fields/keywords_field.rb +44 -0
  68. data/vendor/mail/lib/mail/fields/message_id_field.rb +83 -0
  69. data/vendor/mail/lib/mail/fields/mime_version_field.rb +53 -0
  70. data/vendor/mail/lib/mail/fields/optional_field.rb +13 -0
  71. data/vendor/mail/lib/mail/fields/received_field.rb +67 -0
  72. data/vendor/mail/lib/mail/fields/references_field.rb +55 -0
  73. data/vendor/mail/lib/mail/fields/reply_to_field.rb +55 -0
  74. data/vendor/mail/lib/mail/fields/resent_bcc_field.rb +55 -0
  75. data/vendor/mail/lib/mail/fields/resent_cc_field.rb +55 -0
  76. data/vendor/mail/lib/mail/fields/resent_date_field.rb +35 -0
  77. data/vendor/mail/lib/mail/fields/resent_from_field.rb +55 -0
  78. data/vendor/mail/lib/mail/fields/resent_message_id_field.rb +34 -0
  79. data/vendor/mail/lib/mail/fields/resent_sender_field.rb +62 -0
  80. data/vendor/mail/lib/mail/fields/resent_to_field.rb +55 -0
  81. data/vendor/mail/lib/mail/fields/return_path_field.rb +64 -0
  82. data/vendor/mail/lib/mail/fields/sender_field.rb +67 -0
  83. data/vendor/mail/lib/mail/fields/structured_field.rb +51 -0
  84. data/vendor/mail/lib/mail/fields/subject_field.rb +16 -0
  85. data/vendor/mail/lib/mail/fields/to_field.rb +55 -0
  86. data/vendor/mail/lib/mail/fields/unstructured_field.rb +166 -0
  87. data/vendor/mail/lib/mail/header.rb +262 -0
  88. data/vendor/mail/lib/mail/mail.rb +234 -0
  89. data/vendor/mail/lib/mail/message.rb +1867 -0
  90. data/vendor/mail/lib/mail/network.rb +9 -0
  91. data/vendor/mail/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
  92. data/vendor/mail/lib/mail/network/delivery_methods/sendmail.rb +62 -0
  93. data/vendor/mail/lib/mail/network/delivery_methods/smtp.rb +110 -0
  94. data/vendor/mail/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
  95. data/vendor/mail/lib/mail/network/retriever_methods/imap.rb +18 -0
  96. data/vendor/mail/lib/mail/network/retriever_methods/pop3.rb +149 -0
  97. data/vendor/mail/lib/mail/parsers/address_lists.rb +64 -0
  98. data/vendor/mail/lib/mail/parsers/address_lists.treetop +19 -0
  99. data/vendor/mail/lib/mail/parsers/content_disposition.rb +387 -0
  100. data/vendor/mail/lib/mail/parsers/content_disposition.treetop +46 -0
  101. data/vendor/mail/lib/mail/parsers/content_location.rb +139 -0
  102. data/vendor/mail/lib/mail/parsers/content_location.treetop +20 -0
  103. data/vendor/mail/lib/mail/parsers/content_transfer_encoding.rb +162 -0
  104. data/vendor/mail/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
  105. data/vendor/mail/lib/mail/parsers/content_type.rb +539 -0
  106. data/vendor/mail/lib/mail/parsers/content_type.treetop +58 -0
  107. data/vendor/mail/lib/mail/parsers/date_time.rb +114 -0
  108. data/vendor/mail/lib/mail/parsers/date_time.treetop +11 -0
  109. data/vendor/mail/lib/mail/parsers/envelope_from.rb +194 -0
  110. data/vendor/mail/lib/mail/parsers/envelope_from.treetop +32 -0
  111. data/vendor/mail/lib/mail/parsers/message_ids.rb +45 -0
  112. data/vendor/mail/lib/mail/parsers/message_ids.treetop +15 -0
  113. data/vendor/mail/lib/mail/parsers/mime_version.rb +144 -0
  114. data/vendor/mail/lib/mail/parsers/mime_version.treetop +19 -0
  115. data/vendor/mail/lib/mail/parsers/phrase_lists.rb +45 -0
  116. data/vendor/mail/lib/mail/parsers/phrase_lists.treetop +15 -0
  117. data/vendor/mail/lib/mail/parsers/received.rb +71 -0
  118. data/vendor/mail/lib/mail/parsers/received.treetop +11 -0
  119. data/vendor/mail/lib/mail/parsers/rfc2045.rb +464 -0
  120. data/vendor/mail/lib/mail/parsers/rfc2045.treetop +36 -0
  121. data/vendor/mail/lib/mail/parsers/rfc2822.rb +5318 -0
  122. data/vendor/mail/lib/mail/parsers/rfc2822.treetop +410 -0
  123. data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.rb +3757 -0
  124. data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
  125. data/vendor/mail/lib/mail/part.rb +102 -0
  126. data/vendor/mail/lib/mail/parts_list.rb +34 -0
  127. data/vendor/mail/lib/mail/patterns.rb +30 -0
  128. data/vendor/mail/lib/mail/utilities.rb +181 -0
  129. data/vendor/mail/lib/mail/version.rb +10 -0
  130. data/vendor/mail/lib/mail/version_specific/ruby_1_8.rb +97 -0
  131. data/vendor/mail/lib/mail/version_specific/ruby_1_9.rb +87 -0
  132. data/vendor/mail/lib/tasks/corpus.rake +125 -0
  133. data/vendor/mail/lib/tasks/treetop.rake +10 -0
  134. data/vendor/mail/mail.gemspec +20 -0
  135. data/vendor/mail/reference/US ASCII Table.txt +130 -0
  136. data/vendor/mail/reference/rfc1035 Domain Implementation and Specification.txt +3083 -0
  137. data/vendor/mail/reference/rfc1049 Content-Type Header Field for Internet Messages.txt +451 -0
  138. data/vendor/mail/reference/rfc1344 Implications of MIME for Internet Mail Gateways.txt +586 -0
  139. data/vendor/mail/reference/rfc1345 Character Mnemonics & Character Sets.txt +5761 -0
  140. data/vendor/mail/reference/rfc1524 A User Agent Configuration Mechanism For Multimedia Mail Format Information.txt +675 -0
  141. data/vendor/mail/reference/rfc1652 SMTP Service Extension for 8bit-MIMEtransport.txt +339 -0
  142. data/vendor/mail/reference/rfc1892 Multipart Report .txt +227 -0
  143. data/vendor/mail/reference/rfc1893 Mail System Status Codes.txt +843 -0
  144. data/vendor/mail/reference/rfc2045 Multipurpose Internet Mail Extensions (1).txt +1739 -0
  145. data/vendor/mail/reference/rfc2046 Multipurpose Internet Mail Extensions (2).txt +2467 -0
  146. data/vendor/mail/reference/rfc2047 Multipurpose Internet Mail Extensions (3).txt +843 -0
  147. data/vendor/mail/reference/rfc2048 Multipurpose Internet Mail Extensions (4).txt +1180 -0
  148. data/vendor/mail/reference/rfc2049 Multipurpose Internet Mail Extensions (5).txt +1347 -0
  149. data/vendor/mail/reference/rfc2111 Content-ID and Message-ID URLs.txt +283 -0
  150. data/vendor/mail/reference/rfc2183 Content-Disposition Header Field.txt +675 -0
  151. data/vendor/mail/reference/rfc2231 MIME Parameter Value and Encoded Word Extensions.txt +563 -0
  152. data/vendor/mail/reference/rfc2387 MIME Multipart-Related Content-type.txt +563 -0
  153. data/vendor/mail/reference/rfc2821 Simple Mail Transfer Protocol.txt +3711 -0
  154. data/vendor/mail/reference/rfc2822 Internet Message Format.txt +2859 -0
  155. data/vendor/mail/reference/rfc3462 Reporting of Mail System Administrative Messages.txt +396 -0
  156. data/vendor/mail/reference/rfc3696 Checking and Transformation of Names.txt +898 -0
  157. data/vendor/mail/reference/rfc4155 The application-mbox Media Type.txt +502 -0
  158. data/vendor/mail/reference/rfc4234 Augmented BNF for Syntax Specifications: ABNF.txt +899 -0
  159. data/vendor/mail/reference/rfc822 Standard for the Format of ARPA Internet Text Messages.txt +2900 -0
  160. data/vendor/mail/spec/environment.rb +15 -0
  161. data/vendor/mail/spec/features/making_a_new_message.feature +14 -0
  162. data/vendor/mail/spec/features/steps/env.rb +6 -0
  163. data/vendor/mail/spec/features/steps/making_a_new_message_steps.rb +11 -0
  164. data/vendor/mail/spec/fixtures/attachments/basic_email.eml +31 -0
  165. data/vendor/mail/spec/fixtures/attachments/test.gif +0 -0
  166. data/vendor/mail/spec/fixtures/attachments/test.jpg +0 -0
  167. data/vendor/mail/spec/fixtures/attachments/test.pdf +0 -0
  168. data/vendor/mail/spec/fixtures/attachments/test.png +0 -0
  169. data/vendor/mail/spec/fixtures/attachments/test.tiff +0 -0
  170. data/vendor/mail/spec/fixtures/attachments/test.zip +0 -0
  171. data/vendor/mail/spec/fixtures/attachments//343/201/246/343/201/231/343/201/250.txt +2 -0
  172. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_disposition.eml +29 -0
  173. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_location.eml +32 -0
  174. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_message_rfc822.eml +92 -0
  175. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_only_email.eml +17 -0
  176. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_pdf.eml +70 -0
  177. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_encoded_name.eml +47 -0
  178. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_quoted_filename.eml +60 -0
  179. data/vendor/mail/spec/fixtures/emails/error_emails/cant_parse_from.eml +33 -0
  180. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_7-bit.eml +231 -0
  181. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_empty.eml +33 -0
  182. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_plain.eml +148 -0
  183. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_qp_with_space.eml +53 -0
  184. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_spam.eml +44 -0
  185. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_text-html.eml +50 -0
  186. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_8bits.eml +770 -0
  187. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_semi_colon.eml +269 -0
  188. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_x_uuencode.eml +79 -0
  189. data/vendor/mail/spec/fixtures/emails/error_emails/empty_group_lists.eml +162 -0
  190. data/vendor/mail/spec/fixtures/emails/error_emails/header_fields_with_empty_values.eml +33 -0
  191. data/vendor/mail/spec/fixtures/emails/error_emails/missing_body.eml +16 -0
  192. data/vendor/mail/spec/fixtures/emails/error_emails/missing_content_disposition.eml +43 -0
  193. data/vendor/mail/spec/fixtures/emails/error_emails/multiple_content_types.eml +25 -0
  194. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email11.eml +34 -0
  195. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email12.eml +32 -0
  196. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email2.eml +114 -0
  197. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email4.eml +59 -0
  198. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email7.eml +66 -0
  199. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_encoded_stack_level_too_deep.eml +53 -0
  200. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_illegal_boundary.eml +58 -0
  201. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_mimepart_without_content_type.eml +94 -0
  202. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_multipart_mixed_quoted_boundary.eml +50 -0
  203. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_nested_attachment.eml +100 -0
  204. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_quoted_illegal_boundary.eml +58 -0
  205. data/vendor/mail/spec/fixtures/emails/mime_emails/sig_only_email.eml +29 -0
  206. data/vendor/mail/spec/fixtures/emails/mime_emails/two_from_in_message.eml +42 -0
  207. data/vendor/mail/spec/fixtures/emails/multi_charset/japanese.eml +9 -0
  208. data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment.eml +27 -0
  209. data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment_long_name.eml +44 -0
  210. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce1.eml +179 -0
  211. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce2.eml +179 -0
  212. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_422.eml +98 -0
  213. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_530.eml +97 -0
  214. data/vendor/mail/spec/fixtures/emails/plain_emails/basic_email.eml +31 -0
  215. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email.eml +14 -0
  216. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email10.eml +20 -0
  217. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email5.eml +19 -0
  218. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email6.eml +20 -0
  219. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email8.eml +47 -0
  220. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_bad_time.eml +62 -0
  221. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_double_at_in_header.eml +14 -0
  222. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_incorrect_header.eml +28 -0
  223. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_multiple_from.eml +30 -0
  224. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_quoted_with_0d0a.eml +14 -0
  225. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_reply.eml +32 -0
  226. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_simple.eml +11 -0
  227. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_string_in_date_field.eml +17 -0
  228. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_trailing_dot.eml +21 -0
  229. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_bad_date.eml +48 -0
  230. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_partially_quoted_subject.eml +14 -0
  231. data/vendor/mail/spec/fixtures/emails/rfc2822/example01.eml +8 -0
  232. data/vendor/mail/spec/fixtures/emails/rfc2822/example02.eml +9 -0
  233. data/vendor/mail/spec/fixtures/emails/rfc2822/example03.eml +7 -0
  234. data/vendor/mail/spec/fixtures/emails/rfc2822/example04.eml +7 -0
  235. data/vendor/mail/spec/fixtures/emails/rfc2822/example05.eml +8 -0
  236. data/vendor/mail/spec/fixtures/emails/rfc2822/example06.eml +10 -0
  237. data/vendor/mail/spec/fixtures/emails/rfc2822/example07.eml +9 -0
  238. data/vendor/mail/spec/fixtures/emails/rfc2822/example08.eml +12 -0
  239. data/vendor/mail/spec/fixtures/emails/rfc2822/example09.eml +15 -0
  240. data/vendor/mail/spec/fixtures/emails/rfc2822/example10.eml +15 -0
  241. data/vendor/mail/spec/fixtures/emails/rfc2822/example11.eml +6 -0
  242. data/vendor/mail/spec/fixtures/emails/rfc2822/example12.eml +8 -0
  243. data/vendor/mail/spec/fixtures/emails/rfc2822/example13.eml +10 -0
  244. data/vendor/mail/spec/fixtures/emails/sample_output_multipart +0 -0
  245. data/vendor/mail/spec/mail/attachments_list_spec.rb +214 -0
  246. data/vendor/mail/spec/mail/body_spec.rb +385 -0
  247. data/vendor/mail/spec/mail/configuration_spec.rb +19 -0
  248. data/vendor/mail/spec/mail/core_extensions/string_spec.rb +62 -0
  249. data/vendor/mail/spec/mail/core_extensions_spec.rb +99 -0
  250. data/vendor/mail/spec/mail/elements/address_list_spec.rb +109 -0
  251. data/vendor/mail/spec/mail/elements/address_spec.rb +609 -0
  252. data/vendor/mail/spec/mail/elements/date_time_element_spec.rb +20 -0
  253. data/vendor/mail/spec/mail/elements/envelope_from_element_spec.rb +31 -0
  254. data/vendor/mail/spec/mail/elements/message_ids_element_spec.rb +43 -0
  255. data/vendor/mail/spec/mail/elements/phrase_list_spec.rb +22 -0
  256. data/vendor/mail/spec/mail/elements/received_element_spec.rb +34 -0
  257. data/vendor/mail/spec/mail/encoding_spec.rb +189 -0
  258. data/vendor/mail/spec/mail/encodings/base64_spec.rb +25 -0
  259. data/vendor/mail/spec/mail/encodings/quoted_printable_spec.rb +25 -0
  260. data/vendor/mail/spec/mail/encodings_spec.rb +664 -0
  261. data/vendor/mail/spec/mail/example_emails_spec.rb +303 -0
  262. data/vendor/mail/spec/mail/field_list_spec.rb +33 -0
  263. data/vendor/mail/spec/mail/field_spec.rb +198 -0
  264. data/vendor/mail/spec/mail/fields/bcc_field_spec.rb +89 -0
  265. data/vendor/mail/spec/mail/fields/cc_field_spec.rb +79 -0
  266. data/vendor/mail/spec/mail/fields/comments_field_spec.rb +25 -0
  267. data/vendor/mail/spec/mail/fields/common/address_container_spec.rb +18 -0
  268. data/vendor/mail/spec/mail/fields/common/common_address_spec.rb +132 -0
  269. data/vendor/mail/spec/mail/fields/common/common_date_spec.rb +25 -0
  270. data/vendor/mail/spec/mail/fields/common/common_field_spec.rb +69 -0
  271. data/vendor/mail/spec/mail/fields/common/common_message_id_spec.rb +30 -0
  272. data/vendor/mail/spec/mail/fields/common/parameter_hash_spec.rb +56 -0
  273. data/vendor/mail/spec/mail/fields/content_description_field_spec.rb +39 -0
  274. data/vendor/mail/spec/mail/fields/content_disposition_field_spec.rb +55 -0
  275. data/vendor/mail/spec/mail/fields/content_id_field_spec.rb +117 -0
  276. data/vendor/mail/spec/mail/fields/content_location_field_spec.rb +46 -0
  277. data/vendor/mail/spec/mail/fields/content_transfer_encoding_field_spec.rb +113 -0
  278. data/vendor/mail/spec/mail/fields/content_type_field_spec.rb +678 -0
  279. data/vendor/mail/spec/mail/fields/date_field_spec.rb +73 -0
  280. data/vendor/mail/spec/mail/fields/envelope_spec.rb +48 -0
  281. data/vendor/mail/spec/mail/fields/from_field_spec.rb +89 -0
  282. data/vendor/mail/spec/mail/fields/in_reply_to_field_spec.rb +62 -0
  283. data/vendor/mail/spec/mail/fields/keywords_field_spec.rb +66 -0
  284. data/vendor/mail/spec/mail/fields/message_id_field_spec.rb +147 -0
  285. data/vendor/mail/spec/mail/fields/mime_version_field_spec.rb +166 -0
  286. data/vendor/mail/spec/mail/fields/received_field_spec.rb +44 -0
  287. data/vendor/mail/spec/mail/fields/references_field_spec.rb +35 -0
  288. data/vendor/mail/spec/mail/fields/reply_to_field_spec.rb +67 -0
  289. data/vendor/mail/spec/mail/fields/resent_bcc_field_spec.rb +66 -0
  290. data/vendor/mail/spec/mail/fields/resent_cc_field_spec.rb +66 -0
  291. data/vendor/mail/spec/mail/fields/resent_date_field_spec.rb +39 -0
  292. data/vendor/mail/spec/mail/fields/resent_from_field_spec.rb +66 -0
  293. data/vendor/mail/spec/mail/fields/resent_message_id_field_spec.rb +24 -0
  294. data/vendor/mail/spec/mail/fields/resent_sender_field_spec.rb +58 -0
  295. data/vendor/mail/spec/mail/fields/resent_to_field_spec.rb +66 -0
  296. data/vendor/mail/spec/mail/fields/return_path_field_spec.rb +52 -0
  297. data/vendor/mail/spec/mail/fields/sender_field_spec.rb +58 -0
  298. data/vendor/mail/spec/mail/fields/structured_field_spec.rb +72 -0
  299. data/vendor/mail/spec/mail/fields/to_field_spec.rb +92 -0
  300. data/vendor/mail/spec/mail/fields/unstructured_field_spec.rb +134 -0
  301. data/vendor/mail/spec/mail/header_spec.rb +578 -0
  302. data/vendor/mail/spec/mail/mail_spec.rb +34 -0
  303. data/vendor/mail/spec/mail/message_spec.rb +1409 -0
  304. data/vendor/mail/spec/mail/mime_messages_spec.rb +435 -0
  305. data/vendor/mail/spec/mail/multipart_report_spec.rb +112 -0
  306. data/vendor/mail/spec/mail/network/delivery_methods/file_delivery_spec.rb +79 -0
  307. data/vendor/mail/spec/mail/network/delivery_methods/sendmail_spec.rb +125 -0
  308. data/vendor/mail/spec/mail/network/delivery_methods/smtp_spec.rb +133 -0
  309. data/vendor/mail/spec/mail/network/delivery_methods/test_mailer_spec.rb +57 -0
  310. data/vendor/mail/spec/mail/network/retriever_methods/pop3_spec.rb +180 -0
  311. data/vendor/mail/spec/mail/network_spec.rb +359 -0
  312. data/vendor/mail/spec/mail/parsers/address_lists_parser_spec.rb +15 -0
  313. data/vendor/mail/spec/mail/parsers/content_transfer_encoding_parser_spec.rb +72 -0
  314. data/vendor/mail/spec/mail/part_spec.rb +129 -0
  315. data/vendor/mail/spec/mail/parts_list_spec.rb +12 -0
  316. data/vendor/mail/spec/mail/round_tripping_spec.rb +44 -0
  317. data/vendor/mail/spec/mail/utilities_spec.rb +327 -0
  318. data/vendor/mail/spec/mail/version_specific/escape_paren_1_8_spec.rb +32 -0
  319. data/vendor/mail/spec/matchers/break_down_to.rb +35 -0
  320. data/vendor/mail/spec/spec_helper.rb +163 -0
  321. metadata +442 -0
@@ -0,0 +1,241 @@
1
+ module Mail
2
+ grammar RFC2822Obsolete
3
+
4
+ rule obs_qp
5
+ "\\" [\x00-\x7F]
6
+ end
7
+
8
+ rule obs_text
9
+ LF* CR* (obs_char LF* CR*)*
10
+ end
11
+
12
+ rule obs_char
13
+ [\x00-\x09] / # %d0-127 except CR and
14
+ [\x0B-\x0C] / # LF
15
+ [\x0E-\x7F]
16
+ end
17
+
18
+ rule obs_utext
19
+ obs_text
20
+ end
21
+
22
+ rule obs_phrase
23
+ (word / ".")+
24
+ end
25
+
26
+ rule obs_phrase_list
27
+ phrase / (phrase? CFWS? "," CFWS?)+ phrase?
28
+ end
29
+
30
+ rule obs_FWS
31
+ WSP+ (CRLF WSP+)*
32
+ end
33
+
34
+ rule obs_day_of_week
35
+ CFWS? day_name CFWS?
36
+ end
37
+
38
+ rule obs_year
39
+ CFWS? (DIGIT DIGIT) CFWS?
40
+ end
41
+
42
+ rule obs_month
43
+ CFWS month_name CFWS
44
+ end
45
+
46
+ rule obs_day
47
+ CFWS? (DIGIT / (DIGIT DIGIT)) CFWS?
48
+ end
49
+
50
+ rule obs_hour
51
+ CFWS? (DIGIT DIGIT) CFWS?
52
+ end
53
+
54
+ rule obs_minute
55
+ CFWS? (DIGIT DIGIT) CFWS?
56
+ end
57
+
58
+ rule obs_second
59
+ CFWS? (DIGIT DIGIT) CFWS?
60
+ end
61
+
62
+ rule obs_zone
63
+ "UT" / "GMT" / # Universal Time
64
+ # North American UT
65
+ # offsets
66
+ "EST" / "EDT" / # Eastern: - 5/ - 4
67
+ "CST" / "CDT" / # Central: - 6/ - 5
68
+ "MST" / "MDT" / # Mountain: - 7/ - 6
69
+ "PST" / "PDT" / # Pacific: - 8/ - 7
70
+ #
71
+ [\x41-\x49] / # Military zones - "A"
72
+ [\x4B-\x5A] / # through "I" and "K"
73
+ [\x61-\x69] / # through "Z", both
74
+ [\x6B-\x7A] # upper and lower case
75
+ end
76
+
77
+ rule obs_angle_addr
78
+ CFWS? "<" obs_route? addr_spec ">" CFWS?
79
+ end
80
+
81
+ rule obs_route
82
+ CFWS? obs_domain_list ":" CFWS?
83
+ end
84
+
85
+ rule obs_domain_list
86
+ "@" domain (("," )* CFWS? "@" domain)*
87
+ end
88
+
89
+ rule obs_local_part
90
+ word ("." word)*
91
+ end
92
+
93
+ rule obs_domain
94
+ atom ("." atom)*
95
+ end
96
+
97
+ rule obs_mbox_list
98
+ (mailbox? CFWS? "," CFWS?)+ mailbox?
99
+ end
100
+
101
+ rule obs_addr_list
102
+ (address? CFWS? "," CFWS?)+ address?
103
+ end
104
+
105
+ rule obs_fields
106
+ (obs_return /
107
+ obs_received /
108
+ obs_orig_date /
109
+ obs_from /
110
+ obs_sender /
111
+ obs_reply_to /
112
+ obs_to /
113
+ obs_cc /
114
+ obs_bcc /
115
+ obs_message_id /
116
+ obs_in_reply_to /
117
+ obs_references /
118
+ obs_subject /
119
+ obs_comments /
120
+ obs_keywords /
121
+ obs_resent_date /
122
+ obs_resent_from /
123
+ obs_resent_send /
124
+ obs_resent_rply /
125
+ obs_resent_to /
126
+ obs_resent_cc /
127
+ obs_resent_bcc /
128
+ obs_resent_mid /
129
+ obs_optional)*
130
+ end
131
+
132
+ rule obs_orig_date
133
+ "Date" WSP* ":" date_time CRLF
134
+ end
135
+
136
+ rule obs_from
137
+ "From" WSP* ":" mailbox_list CRLF
138
+ end
139
+
140
+ rule obs_sender
141
+ "Sender" WSP* ":" mailbox CRLF
142
+ end
143
+
144
+ rule obs_reply_to
145
+ "Reply-To" WSP* ":" mailbox_list CRLF
146
+ end
147
+
148
+
149
+ rule obs_to
150
+ "To" WSP* ":" address_list CRLF
151
+ end
152
+
153
+ rule obs_cc
154
+ "Cc" WSP* ":" address_list CRLF
155
+ end
156
+
157
+ rule obs_bcc
158
+ "Bcc" WSP* ":" (address_list / CFWS?) CRLF
159
+ end
160
+
161
+ rule obs_message_id
162
+ "Message-ID" WSP* ":" msg_id CRLF
163
+ end
164
+
165
+ rule obs_in_reply_to
166
+ "In-Reply-To" WSP* ":" (phrase / msg_id)* CRLF
167
+ end
168
+
169
+ rule obs_references
170
+ "References" WSP* ":" (phrase / msg_id)* CRLF
171
+ end
172
+
173
+ rule obs_id_left
174
+ local_part
175
+ end
176
+
177
+ rule obs_id_right
178
+ domain
179
+ end
180
+
181
+ rule obs_subject
182
+ "Subject" WSP* ":" unstructured CRLF
183
+ end
184
+
185
+ rule obs_comments
186
+ "Comments" WSP* ":" unstructured CRLF
187
+ end
188
+
189
+ rule obs_keywords
190
+ "Keywords" WSP* ":" obs_phrase_list CRLF
191
+ end
192
+
193
+ rule obs_resent_from
194
+ "Resent-From" WSP* ":" mailbox_list CRLF
195
+ end
196
+
197
+ rule obs_resent_send
198
+ "Resent-Sender" WSP* ":" mailbox CRLF
199
+ end
200
+
201
+ rule obs_resent_date
202
+ "Resent-Date" WSP* ":" date_time CRLF
203
+ end
204
+
205
+ rule obs_resent_to
206
+ "Resent-To" WSP* ":" address_list CRLF
207
+ end
208
+
209
+ rule obs_resent_cc
210
+ "Resent-Cc" WSP* ":" address_list CRLF
211
+ end
212
+
213
+ rule obs_resent_bcc
214
+ "Resent-Bcc" WSP* ":" (address_list / CFWS?) CRLF
215
+ end
216
+
217
+ rule obs_resent_mid
218
+ "Resent-Message-ID" WSP* ":" msg_id CRLF
219
+ end
220
+
221
+ rule obs_resent_rply
222
+ "Resent-Reply-To" WSP* ":" address_list CRLF
223
+ end
224
+
225
+ rule obs_return
226
+ "Return-Path" WSP* ":" path CRLF
227
+ end
228
+
229
+ rule obs_received
230
+ "Received" WSP* ":" name_val_list CRLF
231
+ end
232
+
233
+ rule obs_path
234
+ obs_angle_addr
235
+ end
236
+
237
+ rule obs_optional
238
+ field_name WSP* ":" unstructured CRLF
239
+ end
240
+ end
241
+ end
@@ -0,0 +1,102 @@
1
+ # encoding: utf-8
2
+ module Mail
3
+ class Part < Message
4
+
5
+ # Creates a new empty Content-ID field and inserts it in the correct order
6
+ # into the Header. The ContentIdField object will automatically generate
7
+ # a unique content ID if you try and encode it or output it to_s without
8
+ # specifying a content id.
9
+ #
10
+ # It will preserve the content ID you specify if you do.
11
+ def add_content_id(content_id_val = '')
12
+ header['content-id'] = content_id_val
13
+ end
14
+
15
+ # Returns true if the part has a content ID field, the field may or may
16
+ # not have a value, but the field exists or not.
17
+ def has_content_id?
18
+ header.has_content_id?
19
+ end
20
+
21
+ def inline_content_id
22
+ add_content_id unless has_content_id?
23
+ uri_escape(unbracket(content_id))
24
+ end
25
+
26
+ def add_required_fields
27
+ add_content_id unless has_content_id?
28
+ super
29
+ end
30
+
31
+ def delivery_status_report_part?
32
+ main_type =~ /message/i && sub_type =~ /delivery-status/i
33
+ end
34
+
35
+ def delivery_status_data
36
+ delivery_status_report_part? ? parse_delivery_status_report : {}
37
+ end
38
+
39
+ def bounced?
40
+ if action.is_a?(Array)
41
+ !!(action.first =~ /failed/i)
42
+ else
43
+ !!(action =~ /failed/i)
44
+ end
45
+ end
46
+
47
+
48
+ # Either returns the action if the message has just a single report, or an
49
+ # array of all the actions, one for each report
50
+ def action
51
+ get_return_values('action')
52
+ end
53
+
54
+ def final_recipient
55
+ get_return_values('final-recipient')
56
+ end
57
+
58
+ def error_status
59
+ get_return_values('status')
60
+ end
61
+
62
+ def diagnostic_code
63
+ get_return_values('diagnostic-code')
64
+ end
65
+
66
+ def remote_mta
67
+ get_return_values('remote-mta')
68
+ end
69
+
70
+ def retryable?
71
+ !(error_status =~ /^5/)
72
+ end
73
+
74
+ private
75
+
76
+ def get_return_values(key)
77
+ if delivery_status_data[key].is_a?(Array)
78
+ delivery_status_data[key].map { |a| a.value }
79
+ else
80
+ delivery_status_data[key].value
81
+ end
82
+ end
83
+
84
+ # A part may not have a header.... so, just init a body if no header
85
+ def parse_message
86
+ header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/m, 2)
87
+ if header_part =~ HEADER_LINE
88
+ self.header = header_part
89
+ self.body = body_part
90
+ else
91
+ self.header = "Content-Type: text/plain\r\n"
92
+ self.body = header_part
93
+ end
94
+ end
95
+
96
+ def parse_delivery_status_report
97
+ @delivery_status_data ||= Header.new(body.to_s.gsub("\r\n\r\n", "\r\n"))
98
+ end
99
+
100
+ end
101
+
102
+ end
@@ -0,0 +1,34 @@
1
+ module Mail
2
+ class PartsList < Array
3
+
4
+ def attachments
5
+ Mail::AttachmentsList.new(self)
6
+ end
7
+
8
+ def collect
9
+ if block_given?
10
+ ary = PartsList.new
11
+ each { |o| ary << yield(o) }
12
+ ary
13
+ else
14
+ to_a
15
+ end
16
+ end
17
+
18
+ alias :collect :map
19
+
20
+ def sort!(order)
21
+ sorted = self.sort do |a, b|
22
+ # OK, 10000 is arbitrary... if anyone actually wants to explicitly sort 10000 parts of a
23
+ # single email message... please show me a use case and I'll put more work into this method,
24
+ # in the meantime, it works :)
25
+ a_order = order.index(a[:content_type].string.downcase) || 10000
26
+ b_order = order.index(b[:content_type].string.downcase) || 10000
27
+ a_order <=> b_order
28
+ end
29
+ self.clear
30
+ sorted.each { |p| self << p }
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: us-ascii
2
+ module Mail
3
+ module Patterns
4
+ white_space = %Q|\x9\x20|
5
+ text = %Q|\x1-\x8\xB\xC\xE-\x7f|
6
+ field_name = %Q|\x21-\x39\x3b-\x7e|
7
+ qp_safe = %Q|\x20-\x3c\x3e-\x7e|
8
+
9
+ aspecial = %Q|()<>[]:;@\\,."| # RFC5322
10
+ tspecial = %Q|()<>@,;:\\"/[]?=| # RFC2045
11
+ lwsp = %Q| \t\r\n|
12
+ control = %Q|\x00-\x1f\x7f-\xff|
13
+
14
+ CRLF = /\r\n/
15
+ WSP = /[#{white_space}]/
16
+ FWS = /#{CRLF}#{WSP}*/
17
+ TEXT = /[#{text}]/ # + obs-text
18
+ FIELD_NAME = /[#{field_name}]+/
19
+ FIELD_BODY = /.+/
20
+ FIELD_LINE = /^[#{field_name}]+:\s*.+$/
21
+ HEADER_LINE = /^([#{field_name}]+:\s*.+)$/
22
+
23
+ QP_UNSAFE = /[^#{qp_safe}]/
24
+ QP_SAFE = /[#{qp_safe}]/
25
+ CONTROL_CHAR = /[#{control}]/n
26
+ ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/n
27
+ PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/n
28
+ TOKEN_UNSAFE = /[#{Regexp.quote tspecial}#{control}#{lwsp}]/n
29
+ end
30
+ end
@@ -0,0 +1,181 @@
1
+ # encoding: utf-8
2
+ module Mail
3
+ module Utilities
4
+ include Patterns
5
+
6
+ # Returns true if the string supplied is free from characters not allowed as an ATOM
7
+ def atom_safe?( str )
8
+ not ATOM_UNSAFE === str
9
+ end
10
+
11
+ # If the string supplied has ATOM unsafe characters in it, will return the string quoted
12
+ # in double quotes, otherwise returns the string unmodified
13
+ def quote_atom( str )
14
+ atom_safe?( str ) ? str : dquote(str)
15
+ end
16
+
17
+ # If the string supplied has PHRASE unsafe characters in it, will return the string quoted
18
+ # in double quotes, otherwise returns the string unmodified
19
+ def quote_phrase( str )
20
+ if RUBY_VERSION >= '1.9'
21
+ original_encoding = str.encoding
22
+ str.force_encoding('ASCII-8BIT')
23
+ if (PHRASE_UNSAFE === str)
24
+ dquote(str).force_encoding(original_encoding)
25
+ else
26
+ str.force_encoding(original_encoding)
27
+ end
28
+ else
29
+ (PHRASE_UNSAFE === str) ? dquote(str) : str
30
+ end
31
+ end
32
+
33
+ # Returns true if the string supplied is free from characters not allowed as a TOKEN
34
+ def token_safe?( str )
35
+ not TOKEN_UNSAFE === str
36
+ end
37
+
38
+ # If the string supplied has TOKEN unsafe characters in it, will return the string quoted
39
+ # in double quotes, otherwise returns the string unmodified
40
+ def quote_token( str )
41
+ token_safe?( str ) ? str : dquote(str)
42
+ end
43
+
44
+ # Wraps supplied string in double quotes unless it is already wrapped.
45
+ #
46
+ # Additionally will escape any double quotation marks in the string with a single
47
+ # backslash in front of the '"' character.
48
+ def dquote( str )
49
+ match = str.match(/^"(.*)?"$/)
50
+ str = match[1] if match
51
+ # First remove all escaped double quotes:
52
+ str = str.gsub(/\\"/, '"')
53
+ # Then wrap and re-escape all double quotes
54
+ '"' + str.gsub(/["]/n) {|s| '\\' + s } + '"'
55
+ end
56
+
57
+ # Unwraps supplied string from inside double quotes.
58
+ #
59
+ # Example:
60
+ #
61
+ # string = '"This is a string"'
62
+ # unquote(string) #=> 'This is a string'
63
+ def unquote( str )
64
+ match = str.match(/^"(.*?)"$/)
65
+ match ? match[1] : str
66
+ end
67
+
68
+ # Wraps a string in parenthesis and escapes any that are in the string itself.
69
+ #
70
+ # Example:
71
+ #
72
+ # paren( 'This is a string' ) #=> '(This is a string)'
73
+ def paren( str )
74
+ RubyVer.paren( str )
75
+ end
76
+
77
+ # Unwraps a string from being wrapped in parenthesis
78
+ #
79
+ # Example:
80
+ #
81
+ # str = '(This is a string)'
82
+ # unparen( str ) #=> 'This is a string'
83
+ def unparen( str )
84
+ match = str.match(/^\((.*?)\)$/)
85
+ match ? match[1] : str
86
+ end
87
+
88
+ # Wraps a string in angle brackets and escapes any that are in the string itself
89
+ #
90
+ # Example:
91
+ #
92
+ # bracket( 'This is a string' ) #=> '<This is a string>'
93
+ def bracket( str )
94
+ RubyVer.bracket( str )
95
+ end
96
+
97
+ # Unwraps a string from being wrapped in parenthesis
98
+ #
99
+ # Example:
100
+ #
101
+ # str = '<This is a string>'
102
+ # unbracket( str ) #=> 'This is a string'
103
+ def unbracket( str )
104
+ match = str.match(/^\<(.*?)\>$/)
105
+ match ? match[1] : str
106
+ end
107
+
108
+ # Escape parenthesies in a string
109
+ #
110
+ # Example:
111
+ #
112
+ # str = 'This is (a) string'
113
+ # escape_paren( str ) #=> 'This is \(a\) string'
114
+ def escape_paren( str )
115
+ RubyVer.escape_paren( str )
116
+ end
117
+
118
+ def uri_escape( str )
119
+ URI.escape(str)
120
+ end
121
+
122
+ def uri_unescape( str )
123
+ URI.unescape(str)
124
+ end
125
+
126
+ # Matches two objects with their to_s values case insensitively
127
+ #
128
+ # Example:
129
+ #
130
+ # obj2 = "This_is_An_object"
131
+ # obj1 = :this_IS_an_object
132
+ # match_to_s( obj1, obj2 ) #=> true
133
+ def match_to_s( obj1, obj2 )
134
+ obj1.to_s.downcase == obj2.to_s.downcase
135
+ end
136
+
137
+ # Capitalizes a string that is joined by hyphens correctly.
138
+ #
139
+ # Example:
140
+ #
141
+ # string = 'resent-from-field'
142
+ # capitalize_field( string ) #=> 'Resent-From-Field'
143
+ def capitalize_field( str )
144
+ str.to_s.split("-").map { |v| v.capitalize }.join("-")
145
+ end
146
+
147
+ # Takes an underscored word and turns it into a class name
148
+ #
149
+ # Example:
150
+ #
151
+ # constantize("hello") #=> "Hello"
152
+ # constantize("hello-there") #=> "HelloThere"
153
+ # constantize("hello-there-mate") #=> "HelloThereMate"
154
+ def constantize( str )
155
+ str.to_s.split(/[-_]/).map { |v| v.capitalize }.to_s
156
+ end
157
+
158
+ # Swaps out all underscores (_) for hyphens (-) good for stringing from symbols
159
+ # a field name.
160
+ #
161
+ # Example:
162
+ #
163
+ # string = :resent_from_field
164
+ # dasherize ( string ) #=> 'resent_from_field'
165
+ def dasherize( str )
166
+ str.to_s.gsub('_', '-')
167
+ end
168
+
169
+ # Swaps out all hyphens (-) for underscores (_) good for stringing to symbols
170
+ # a field name.
171
+ #
172
+ # Example:
173
+ #
174
+ # string = :resent_from_field
175
+ # underscoreize ( string ) #=> 'resent_from_field'
176
+ def underscoreize( str )
177
+ str.to_s.downcase.gsub('-', '_')
178
+ end
179
+
180
+ end
181
+ end