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.
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,843 @@
1
+
2
+
3
+
4
+
5
+
6
+ Network Working Group K. Moore
7
+ Request for Comments: 2047 University of Tennessee
8
+ Obsoletes: 1521, 1522, 1590 November 1996
9
+ Category: Standards Track
10
+
11
+
12
+ MIME (Multipurpose Internet Mail Extensions) Part Three:
13
+ Message Header Extensions for Non-ASCII Text
14
+
15
+ Status of this Memo
16
+
17
+ This document specifies an Internet standards track protocol for the
18
+ Internet community, and requests discussion and suggestions for
19
+ improvements. Please refer to the current edition of the "Internet
20
+ Official Protocol Standards" (STD 1) for the standardization state
21
+ and status of this protocol. Distribution of this memo is unlimited.
22
+
23
+ Abstract
24
+
25
+ STD 11, RFC 822, defines a message representation protocol specifying
26
+ considerable detail about US-ASCII message headers, and leaves the
27
+ message content, or message body, as flat US-ASCII text. This set of
28
+ documents, collectively called the Multipurpose Internet Mail
29
+ Extensions, or MIME, redefines the format of messages to allow for
30
+
31
+ (1) textual message bodies in character sets other than US-ASCII,
32
+
33
+ (2) an extensible set of different formats for non-textual message
34
+ bodies,
35
+
36
+ (3) multi-part message bodies, and
37
+
38
+ (4) textual header information in character sets other than US-ASCII.
39
+
40
+ These documents are based on earlier work documented in RFC 934, STD
41
+ 11, and RFC 1049, but extends and revises them. Because RFC 822 said
42
+ so little about message bodies, these documents are largely
43
+ orthogonal to (rather than a revision of) RFC 822.
44
+
45
+ This particular document is the third document in the series. It
46
+ describes extensions to RFC 822 to allow non-US-ASCII text data in
47
+ Internet mail header fields.
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ Moore Standards Track [Page 1]
58
+
59
+ RFC 2047 Message Header Extensions November 1996
60
+
61
+
62
+ Other documents in this series include:
63
+
64
+ + RFC 2045, which specifies the various headers used to describe
65
+ the structure of MIME messages.
66
+
67
+ + RFC 2046, which defines the general structure of the MIME media
68
+ typing system and defines an initial set of media types,
69
+
70
+ + RFC 2048, which specifies various IANA registration procedures
71
+ for MIME-related facilities, and
72
+
73
+ + RFC 2049, which describes MIME conformance criteria and
74
+ provides some illustrative examples of MIME message formats,
75
+ acknowledgements, and the bibliography.
76
+
77
+ These documents are revisions of RFCs 1521, 1522, and 1590, which
78
+ themselves were revisions of RFCs 1341 and 1342. An appendix in RFC
79
+ 2049 describes differences and changes from previous versions.
80
+
81
+ 1. Introduction
82
+
83
+ RFC 2045 describes a mechanism for denoting textual body parts which
84
+ are coded in various character sets, as well as methods for encoding
85
+ such body parts as sequences of printable US-ASCII characters. This
86
+ memo describes similar techniques to allow the encoding of non-ASCII
87
+ text in various portions of a RFC 822 [2] message header, in a manner
88
+ which is unlikely to confuse existing message handling software.
89
+
90
+ Like the encoding techniques described in RFC 2045, the techniques
91
+ outlined here were designed to allow the use of non-ASCII characters
92
+ in message headers in a way which is unlikely to be disturbed by the
93
+ quirks of existing Internet mail handling programs. In particular,
94
+ some mail relaying programs are known to (a) delete some message
95
+ header fields while retaining others, (b) rearrange the order of
96
+ addresses in To or Cc fields, (c) rearrange the (vertical) order of
97
+ header fields, and/or (d) "wrap" message headers at different places
98
+ than those in the original message. In addition, some mail reading
99
+ programs are known to have difficulty correctly parsing message
100
+ headers which, while legal according to RFC 822, make use of
101
+ backslash-quoting to "hide" special characters such as "<", ",", or
102
+ ":", or which exploit other infrequently-used features of that
103
+ specification.
104
+
105
+ While it is unfortunate that these programs do not correctly
106
+ interpret RFC 822 headers, to "break" these programs would cause
107
+ severe operational problems for the Internet mail system. The
108
+ extensions described in this memo therefore do not rely on little-
109
+ used features of RFC 822.
110
+
111
+
112
+
113
+ Moore Standards Track [Page 2]
114
+
115
+ RFC 2047 Message Header Extensions November 1996
116
+
117
+
118
+ Instead, certain sequences of "ordinary" printable ASCII characters
119
+ (known as "encoded-words") are reserved for use as encoded data. The
120
+ syntax of encoded-words is such that they are unlikely to
121
+ "accidentally" appear as normal text in message headers.
122
+ Furthermore, the characters used in encoded-words are restricted to
123
+ those which do not have special meanings in the context in which the
124
+ encoded-word appears.
125
+
126
+ Generally, an "encoded-word" is a sequence of printable ASCII
127
+ characters that begins with "=?", ends with "?=", and has two "?"s in
128
+ between. It specifies a character set and an encoding method, and
129
+ also includes the original text encoded as graphic ASCII characters,
130
+ according to the rules for that encoding method.
131
+
132
+ A mail composer that implements this specification will provide a
133
+ means of inputting non-ASCII text in header fields, but will
134
+ translate these fields (or appropriate portions of these fields) into
135
+ encoded-words before inserting them into the message header.
136
+
137
+ A mail reader that implements this specification will recognize
138
+ encoded-words when they appear in certain portions of the message
139
+ header. Instead of displaying the encoded-word "as is", it will
140
+ reverse the encoding and display the original text in the designated
141
+ character set.
142
+
143
+ NOTES
144
+
145
+ This memo relies heavily on notation and terms defined RFC 822 and
146
+ RFC 2045. In particular, the syntax for the ABNF used in this memo
147
+ is defined in RFC 822, as well as many of the terminal or nonterminal
148
+ symbols from RFC 822 are used in the grammar for the header
149
+ extensions defined here. Among the symbols defined in RFC 822 and
150
+ referenced in this memo are: 'addr-spec', 'atom', 'CHAR', 'comment',
151
+ 'CTLs', 'ctext', 'linear-white-space', 'phrase', 'quoted-pair'.
152
+ 'quoted-string', 'SPACE', and 'word'. Successful implementation of
153
+ this protocol extension requires careful attention to the RFC 822
154
+ definitions of these terms.
155
+
156
+ When the term "ASCII" appears in this memo, it refers to the "7-Bit
157
+ American Standard Code for Information Interchange", ANSI X3.4-1986.
158
+ The MIME charset name for this character set is "US-ASCII". When not
159
+ specifically referring to the MIME charset name, this document uses
160
+ the term "ASCII", both for brevity and for consistency with RFC 822.
161
+ However, implementors are warned that the character set name must be
162
+ spelled "US-ASCII" in MIME message and body part headers.
163
+
164
+
165
+
166
+
167
+
168
+
169
+ Moore Standards Track [Page 3]
170
+
171
+ RFC 2047 Message Header Extensions November 1996
172
+
173
+
174
+ This memo specifies a protocol for the representation of non-ASCII
175
+ text in message headers. It specifically DOES NOT define any
176
+ translation between "8-bit headers" and pure ASCII headers, nor is
177
+ any such translation assumed to be possible.
178
+
179
+ 2. Syntax of encoded-words
180
+
181
+ An 'encoded-word' is defined by the following ABNF grammar. The
182
+ notation of RFC 822 is used, with the exception that white space
183
+ characters MUST NOT appear between components of an 'encoded-word'.
184
+
185
+ encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
186
+
187
+ charset = token ; see section 3
188
+
189
+ encoding = token ; see section 4
190
+
191
+ token = 1*<Any CHAR except SPACE, CTLs, and especials>
192
+
193
+ especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "
194
+ <"> / "/" / "[" / "]" / "?" / "." / "="
195
+
196
+ encoded-text = 1*<Any printable ASCII character other than "?"
197
+ or SPACE>
198
+ ; (but see "Use of encoded-words in message
199
+ ; headers", section 5)
200
+
201
+ Both 'encoding' and 'charset' names are case-independent. Thus the
202
+ charset name "ISO-8859-1" is equivalent to "iso-8859-1", and the
203
+ encoding named "Q" may be spelled either "Q" or "q".
204
+
205
+ An 'encoded-word' may not be more than 75 characters long, including
206
+ 'charset', 'encoding', 'encoded-text', and delimiters. If it is
207
+ desirable to encode more text than will fit in an 'encoded-word' of
208
+ 75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may
209
+ be used.
210
+
211
+ While there is no limit to the length of a multiple-line header
212
+ field, each line of a header field that contains one or more
213
+ 'encoded-word's is limited to 76 characters.
214
+
215
+ The length restrictions are included both to ease interoperability
216
+ through internetwork mail gateways, and to impose a limit on the
217
+ amount of lookahead a header parser must employ (while looking for a
218
+ final ?= delimiter) before it can decide whether a token is an
219
+ "encoded-word" or something else.
220
+
221
+
222
+
223
+
224
+
225
+ Moore Standards Track [Page 4]
226
+
227
+ RFC 2047 Message Header Extensions November 1996
228
+
229
+
230
+ IMPORTANT: 'encoded-word's are designed to be recognized as 'atom's
231
+ by an RFC 822 parser. As a consequence, unencoded white space
232
+ characters (such as SPACE and HTAB) are FORBIDDEN within an
233
+ 'encoded-word'. For example, the character sequence
234
+
235
+ =?iso-8859-1?q?this is some text?=
236
+
237
+ would be parsed as four 'atom's, rather than as a single 'atom' (by
238
+ an RFC 822 parser) or 'encoded-word' (by a parser which understands
239
+ 'encoded-words'). The correct way to encode the string "this is some
240
+ text" is to encode the SPACE characters as well, e.g.
241
+
242
+ =?iso-8859-1?q?this=20is=20some=20text?=
243
+
244
+ The characters which may appear in 'encoded-text' are further
245
+ restricted by the rules in section 5.
246
+
247
+ 3. Character sets
248
+
249
+ The 'charset' portion of an 'encoded-word' specifies the character
250
+ set associated with the unencoded text. A 'charset' can be any of
251
+ the character set names allowed in an MIME "charset" parameter of a
252
+ "text/plain" body part, or any character set name registered with
253
+ IANA for use with the MIME text/plain content-type.
254
+
255
+ Some character sets use code-switching techniques to switch between
256
+ "ASCII mode" and other modes. If unencoded text in an 'encoded-word'
257
+ contains a sequence which causes the charset interpreter to switch
258
+ out of ASCII mode, it MUST contain additional control codes such that
259
+ ASCII mode is again selected at the end of the 'encoded-word'. (This
260
+ rule applies separately to each 'encoded-word', including adjacent
261
+ 'encoded-word's within a single header field.)
262
+
263
+ When there is a possibility of using more than one character set to
264
+ represent the text in an 'encoded-word', and in the absence of
265
+ private agreements between sender and recipients of a message, it is
266
+ recommended that members of the ISO-8859-* series be used in
267
+ preference to other character sets.
268
+
269
+ 4. Encodings
270
+
271
+ Initially, the legal values for "encoding" are "Q" and "B". These
272
+ encodings are described below. The "Q" encoding is recommended for
273
+ use when most of the characters to be encoded are in the ASCII
274
+ character set; otherwise, the "B" encoding should be used.
275
+ Nevertheless, a mail reader which claims to recognize 'encoded-word's
276
+ MUST be able to accept either encoding for any character set which it
277
+ supports.
278
+
279
+
280
+
281
+ Moore Standards Track [Page 5]
282
+
283
+ RFC 2047 Message Header Extensions November 1996
284
+
285
+
286
+ Only a subset of the printable ASCII characters may be used in
287
+ 'encoded-text'. Space and tab characters are not allowed, so that
288
+ the beginning and end of an 'encoded-word' are obvious. The "?"
289
+ character is used within an 'encoded-word' to separate the various
290
+ portions of the 'encoded-word' from one another, and thus cannot
291
+ appear in the 'encoded-text' portion. Other characters are also
292
+ illegal in certain contexts. For example, an 'encoded-word' in a
293
+ 'phrase' preceding an address in a From header field may not contain
294
+ any of the "specials" defined in RFC 822. Finally, certain other
295
+ characters are disallowed in some contexts, to ensure reliability for
296
+ messages that pass through internetwork mail gateways.
297
+
298
+ The "B" encoding automatically meets these requirements. The "Q"
299
+ encoding allows a wide range of printable characters to be used in
300
+ non-critical locations in the message header (e.g., Subject), with
301
+ fewer characters available for use in other locations.
302
+
303
+ 4.1. The "B" encoding
304
+
305
+ The "B" encoding is identical to the "BASE64" encoding defined by RFC
306
+ 2045.
307
+
308
+ 4.2. The "Q" encoding
309
+
310
+ The "Q" encoding is similar to the "Quoted-Printable" content-
311
+ transfer-encoding defined in RFC 2045. It is designed to allow text
312
+ containing mostly ASCII characters to be decipherable on an ASCII
313
+ terminal without decoding.
314
+
315
+ (1) Any 8-bit value may be represented by a "=" followed by two
316
+ hexadecimal digits. For example, if the character set in use
317
+ were ISO-8859-1, the "=" character would thus be encoded as
318
+ "=3D", and a SPACE by "=20". (Upper case should be used for
319
+ hexadecimal digits "A" through "F".)
320
+
321
+ (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
322
+ represented as "_" (underscore, ASCII 95.). (This character may
323
+ not pass through some internetwork mail gateways, but its use
324
+ will greatly enhance readability of "Q" encoded data with mail
325
+ readers that do not support this encoding.) Note that the "_"
326
+ always represents hexadecimal 20, even if the SPACE character
327
+ occupies a different code position in the character set in use.
328
+
329
+ (3) 8-bit values which correspond to printable ASCII characters other
330
+ than "=", "?", and "_" (underscore), MAY be represented as those
331
+ characters. (But see section 5 for restrictions.) In
332
+ particular, SPACE and TAB MUST NOT be represented as themselves
333
+ within encoded words.
334
+
335
+
336
+
337
+ Moore Standards Track [Page 6]
338
+
339
+ RFC 2047 Message Header Extensions November 1996
340
+
341
+
342
+ 5. Use of encoded-words in message headers
343
+
344
+ An 'encoded-word' may appear in a message header or body part header
345
+ according to the following rules:
346
+
347
+ (1) An 'encoded-word' may replace a 'text' token (as defined by RFC 822)
348
+ in any Subject or Comments header field, any extension message
349
+ header field, or any MIME body part field for which the field body
350
+ is defined as '*text'. An 'encoded-word' may also appear in any
351
+ user-defined ("X-") message or body part header field.
352
+
353
+ Ordinary ASCII text and 'encoded-word's may appear together in the
354
+ same header field. However, an 'encoded-word' that appears in a
355
+ header field defined as '*text' MUST be separated from any adjacent
356
+ 'encoded-word' or 'text' by 'linear-white-space'.
357
+
358
+ (2) An 'encoded-word' may appear within a 'comment' delimited by "(" and
359
+ ")", i.e., wherever a 'ctext' is allowed. More precisely, the RFC
360
+ 822 ABNF definition for 'comment' is amended as follows:
361
+
362
+ comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")"
363
+
364
+ A "Q"-encoded 'encoded-word' which appears in a 'comment' MUST NOT
365
+ contain the characters "(", ")" or "
366
+ 'encoded-word' that appears in a 'comment' MUST be separated from
367
+ any adjacent 'encoded-word' or 'ctext' by 'linear-white-space'.
368
+
369
+ It is important to note that 'comment's are only recognized inside
370
+ "structured" field bodies. In fields whose bodies are defined as
371
+ '*text', "(" and ")" are treated as ordinary characters rather than
372
+ comment delimiters, and rule (1) of this section applies. (See RFC
373
+ 822, sections 3.1.2 and 3.1.3)
374
+
375
+ (3) As a replacement for a 'word' entity within a 'phrase', for example,
376
+ one that precedes an address in a From, To, or Cc header. The ABNF
377
+ definition for 'phrase' from RFC 822 thus becomes:
378
+
379
+ phrase = 1*( encoded-word / word )
380
+
381
+ In this case the set of characters that may be used in a "Q"-encoded
382
+ 'encoded-word' is restricted to: <upper and lower case ASCII
383
+ letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"
384
+ (underscore, ASCII 95.)>. An 'encoded-word' that appears within a
385
+ 'phrase' MUST be separated from any adjacent 'word', 'text' or
386
+ 'special' by 'linear-white-space'.
387
+
388
+
389
+
390
+
391
+
392
+
393
+ Moore Standards Track [Page 7]
394
+
395
+ RFC 2047 Message Header Extensions November 1996
396
+
397
+
398
+ These are the ONLY locations where an 'encoded-word' may appear. In
399
+ particular:
400
+
401
+ + An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.
402
+
403
+ + An 'encoded-word' MUST NOT appear within a 'quoted-string'.
404
+
405
+ + An 'encoded-word' MUST NOT be used in a Received header field.
406
+
407
+ + An 'encoded-word' MUST NOT be used in parameter of a MIME
408
+ Content-Type or Content-Disposition field, or in any structured
409
+ field body except within a 'comment' or 'phrase'.
410
+
411
+ The 'encoded-text' in an 'encoded-word' must be self-contained;
412
+ 'encoded-text' MUST NOT be continued from one 'encoded-word' to
413
+ another. This implies that the 'encoded-text' portion of a "B"
414
+ 'encoded-word' will be a multiple of 4 characters long; for a "Q"
415
+ 'encoded-word', any "=" character that appears in the 'encoded-text'
416
+ portion will be followed by two hexadecimal characters.
417
+
418
+ Each 'encoded-word' MUST encode an integral number of octets. The
419
+ 'encoded-text' in each 'encoded-word' must be well-formed according
420
+ to the encoding specified; the 'encoded-text' may not be continued in
421
+ the next 'encoded-word'. (For example, "=?charset?Q?=?=
422
+ =?charset?Q?AB?=" would be illegal, because the two hex digits "AB"
423
+ must follow the "=" in the same 'encoded-word'.)
424
+
425
+ Each 'encoded-word' MUST represent an integral number of characters.
426
+ A multi-octet character may not be split across adjacent 'encoded-
427
+ word's.
428
+
429
+ Only printable and white space character data should be encoded using
430
+ this scheme. However, since these encoding schemes allow the
431
+ encoding of arbitrary octet values, mail readers that implement this
432
+ decoding should also ensure that display of the decoded data on the
433
+ recipient's terminal will not cause unwanted side-effects.
434
+
435
+ Use of these methods to encode non-textual data (e.g., pictures or
436
+ sounds) is not defined by this memo. Use of 'encoded-word's to
437
+ represent strings of purely ASCII characters is allowed, but
438
+ discouraged. In rare cases it may be necessary to encode ordinary
439
+ text that looks like an 'encoded-word'.
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+ Moore Standards Track [Page 8]
450
+
451
+ RFC 2047 Message Header Extensions November 1996
452
+
453
+
454
+ 6. Support of 'encoded-word's by mail readers
455
+
456
+ 6.1. Recognition of 'encoded-word's in message headers
457
+
458
+ A mail reader must parse the message and body part headers according
459
+ to the rules in RFC 822 to correctly recognize 'encoded-word's.
460
+
461
+ 'encoded-word's are to be recognized as follows:
462
+
463
+ (1) Any message or body part header field defined as '*text', or any
464
+ user-defined header field, should be parsed as follows: Beginning
465
+ at the start of the field-body and immediately following each
466
+ occurrence of 'linear-white-space', each sequence of up to 75
467
+ printable characters (not containing any 'linear-white-space')
468
+ should be examined to see if it is an 'encoded-word' according to
469
+ the syntax rules in section 2. Any other sequence of printable
470
+ characters should be treated as ordinary ASCII text.
471
+
472
+ (2) Any header field not defined as '*text' should be parsed
473
+ according to the syntax rules for that header field. However,
474
+ any 'word' that appears within a 'phrase' should be treated as an
475
+ 'encoded-word' if it meets the syntax rules in section 2.
476
+ Otherwise it should be treated as an ordinary 'word'.
477
+
478
+ (3) Within a 'comment', any sequence of up to 75 printable characters
479
+ (not containing 'linear-white-space'), that meets the syntax
480
+ rules in section 2, should be treated as an 'encoded-word'.
481
+ Otherwise it should be treated as normal comment text.
482
+
483
+ (4) A MIME-Version header field is NOT required to be present for
484
+ 'encoded-word's to be interpreted according to this
485
+ specification. One reason for this is that the mail reader is
486
+ not expected to parse the entire message header before displaying
487
+ lines that may contain 'encoded-word's.
488
+
489
+ 6.2. Display of 'encoded-word's
490
+
491
+ Any 'encoded-word's so recognized are decoded, and if possible, the
492
+ resulting unencoded text is displayed in the original character set.
493
+
494
+ NOTE: Decoding and display of encoded-words occurs *after* a
495
+ structured field body is parsed into tokens. It is therefore
496
+ possible to hide 'special' characters in encoded-words which, when
497
+ displayed, will be indistinguishable from 'special' characters in the
498
+ surrounding text. For this and other reasons, it is NOT generally
499
+ possible to translate a message header containing 'encoded-word's to
500
+ an unencoded form which can be parsed by an RFC 822 mail reader.
501
+
502
+
503
+
504
+
505
+ Moore Standards Track [Page 9]
506
+
507
+ RFC 2047 Message Header Extensions November 1996
508
+
509
+
510
+ When displaying a particular header field that contains multiple
511
+ 'encoded-word's, any 'linear-white-space' that separates a pair of
512
+ adjacent 'encoded-word's is ignored. (This is to allow the use of
513
+ multiple 'encoded-word's to represent long strings of unencoded text,
514
+ without having to separate 'encoded-word's where spaces occur in the
515
+ unencoded text.)
516
+
517
+ In the event other encodings are defined in the future, and the mail
518
+ reader does not support the encoding used, it may either (a) display
519
+ the 'encoded-word' as ordinary text, or (b) substitute an appropriate
520
+ message indicating that the text could not be decoded.
521
+
522
+ If the mail reader does not support the character set used, it may
523
+ (a) display the 'encoded-word' as ordinary text (i.e., as it appears
524
+ in the header), (b) make a "best effort" to display using such
525
+ characters as are available, or (c) substitute an appropriate message
526
+ indicating that the decoded text could not be displayed.
527
+
528
+ If the character set being used employs code-switching techniques,
529
+ display of the encoded text implicitly begins in "ASCII mode". In
530
+ addition, the mail reader must ensure that the output device is once
531
+ again in "ASCII mode" after the 'encoded-word' is displayed.
532
+
533
+ 6.3. Mail reader handling of incorrectly formed 'encoded-word's
534
+
535
+ It is possible that an 'encoded-word' that is legal according to the
536
+ syntax defined in section 2, is incorrectly formed according to the
537
+ rules for the encoding being used. For example:
538
+
539
+ (1) An 'encoded-word' which contains characters which are not legal
540
+ for a particular encoding (for example, a "-" in the "B"
541
+ encoding, or a SPACE or HTAB in either the "B" or "Q" encoding),
542
+ is incorrectly formed.
543
+
544
+ (2) Any 'encoded-word' which encodes a non-integral number of
545
+ characters or octets is incorrectly formed.
546
+
547
+ A mail reader need not attempt to display the text associated with an
548
+ 'encoded-word' that is incorrectly formed. However, a mail reader
549
+ MUST NOT prevent the display or handling of a message because an
550
+ 'encoded-word' is incorrectly formed.
551
+
552
+ 7. Conformance
553
+
554
+ A mail composing program claiming compliance with this specification
555
+ MUST ensure that any string of non-white-space printable ASCII
556
+ characters within a '*text' or '*ctext' that begins with "=?" and
557
+ ends with "?=" be a valid 'encoded-word'. ("begins" means: at the
558
+
559
+
560
+
561
+ Moore Standards Track [Page 10]
562
+
563
+ RFC 2047 Message Header Extensions November 1996
564
+
565
+
566
+ start of the field-body, immediately following 'linear-white-space',
567
+ or immediately following a "(" for an 'encoded-word' within '*ctext';
568
+ "ends" means: at the end of the field-body, immediately preceding
569
+ 'linear-white-space', or immediately preceding a ")" for an
570
+ 'encoded-word' within '*ctext'.) In addition, any 'word' within a
571
+ 'phrase' that begins with "=?" and ends with "?=" must be a valid
572
+ 'encoded-word'.
573
+
574
+ A mail reading program claiming compliance with this specification
575
+ must be able to distinguish 'encoded-word's from 'text', 'ctext', or
576
+ 'word's, according to the rules in section 6, anytime they appear in
577
+ appropriate places in message headers. It must support both the "B"
578
+ and "Q" encodings for any character set which it supports. The
579
+ program must be able to display the unencoded text if the character
580
+ set is "US-ASCII". For the ISO-8859-* character sets, the mail
581
+ reading program must at least be able to display the characters which
582
+ are also in the ASCII set.
583
+
584
+ 8. Examples
585
+
586
+ The following are examples of message headers containing 'encoded-
587
+ word's:
588
+
589
+ From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>
590
+ To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>
591
+ CC: =?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>
592
+ Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
593
+ =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
594
+
595
+ Note: In the first 'encoded-word' of the Subject field above, the
596
+ last "=" at the end of the 'encoded-text' is necessary because each
597
+ 'encoded-word' must be self-contained (the "=" character completes a
598
+ group of 4 base64 characters representing 2 octets). An additional
599
+ octet could have been encoded in the first 'encoded-word' (so that
600
+ the encoded-word would contain an exact multiple of 3 encoded
601
+ octets), except that the second 'encoded-word' uses a different
602
+ 'charset' than the first one.
603
+
604
+ From: =?ISO-8859-1?Q?Olle_J=E4rnefors?= <ojarnef@admin.kth.se>
605
+ To: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se
606
+ Subject: Time for ISO 10646?
607
+
608
+ To: Dave Crocker <dcrocker@mordor.stanford.edu>
609
+ Cc: ietf-822@dimacs.rutgers.edu, paf@comsol.se
610
+ From: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <paf@nada.kth.se>
611
+ Subject: Re: RFC-HDR care and feeding
612
+
613
+
614
+
615
+
616
+
617
+ Moore Standards Track [Page 11]
618
+
619
+ RFC 2047 Message Header Extensions November 1996
620
+
621
+
622
+ From: Nathaniel Borenstein <nsb@thumper.bellcore.com>
623
+ (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)
624
+ To: Greg Vaudreuil <gvaudre@NRI.Reston.VA.US>, Ned Freed
625
+ <ned@innosoft.com>, Keith Moore <moore@cs.utk.edu>
626
+ Subject: Test of new header generator
627
+ MIME-Version: 1.0
628
+ Content-type: text/plain; charset=ISO-8859-1
629
+
630
+ The following examples illustrate how text containing 'encoded-word's
631
+ which appear in a structured field body. The rules are slightly
632
+ different for fields defined as '*text' because "(" and ")" are not
633
+ recognized as 'comment' delimiters. [Section 5, paragraph (1)].
634
+
635
+ In each of the following examples, if the same sequence were to occur
636
+ in a '*text' field, the "displayed as" form would NOT be treated as
637
+ encoded words, but be identical to the "encoded form". This is
638
+ because each of the encoded-words in the following examples is
639
+ adjacent to a "(" or ")" character.
640
+
641
+ encoded form displayed as
642
+ ---------------------------------------------------------------------
643
+ (=?ISO-8859-1?Q?a?=) (a)
644
+
645
+ (=?ISO-8859-1?Q?a?= b) (a b)
646
+
647
+ Within a 'comment', white space MUST appear between an
648
+ 'encoded-word' and surrounding text. [Section 5,
649
+ paragraph (2)]. However, white space is not needed between
650
+ the initial "(" that begins the 'comment', and the
651
+ 'encoded-word'.
652
+
653
+
654
+ (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=) (ab)
655
+
656
+ White space between adjacent 'encoded-word's is not
657
+ displayed.
658
+
659
+ (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=) (ab)
660
+
661
+ Even multiple SPACEs between 'encoded-word's are ignored
662
+ for the purpose of display.
663
+
664
+ (=?ISO-8859-1?Q?a?= (ab)
665
+ =?ISO-8859-1?Q?b?=)
666
+
667
+ Any amount of linear-space-white between 'encoded-word's,
668
+ even if it includes a CRLF followed by one or more SPACEs,
669
+ is ignored for the purposes of display.
670
+
671
+
672
+
673
+ Moore Standards Track [Page 12]
674
+
675
+ RFC 2047 Message Header Extensions November 1996
676
+
677
+
678
+ (=?ISO-8859-1?Q?a_b?=) (a b)
679
+
680
+ In order to cause a SPACE to be displayed within a portion
681
+ of encoded text, the SPACE MUST be encoded as part of the
682
+ 'encoded-word'.
683
+
684
+ (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=) (a b)
685
+
686
+ In order to cause a SPACE to be displayed between two strings
687
+ of encoded text, the SPACE MAY be encoded as part of one of
688
+ the 'encoded-word's.
689
+
690
+ 9. References
691
+
692
+ [RFC 822] Crocker, D., "Standard for the Format of ARPA Internet Text
693
+ Messages", STD 11, RFC 822, UDEL, August 1982.
694
+
695
+ [RFC 2049] Borenstein, N., and N. Freed, "Multipurpose Internet Mail
696
+ Extensions (MIME) Part Five: Conformance Criteria and Examples",
697
+ RFC 2049, November 1996.
698
+
699
+ [RFC 2045] Borenstein, N., and N. Freed, "Multipurpose Internet Mail
700
+ Extensions (MIME) Part One: Format of Internet Message Bodies",
701
+ RFC 2045, November 1996.
702
+
703
+ [RFC 2046] Borenstein N., and N. Freed, "Multipurpose Internet Mail
704
+ Extensions (MIME) Part Two: Media Types", RFC 2046,
705
+ November 1996.
706
+
707
+ [RFC 2048] Freed, N., Klensin, J., and J. Postel, "Multipurpose
708
+ Internet Mail Extensions (MIME) Part Four: Registration
709
+ Procedures", RFC 2048, November 1996.
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+ Moore Standards Track [Page 13]
730
+
731
+ RFC 2047 Message Header Extensions November 1996
732
+
733
+
734
+ 10. Security Considerations
735
+
736
+ Security issues are not discussed in this memo.
737
+
738
+ 11. Acknowledgements
739
+
740
+ The author wishes to thank Nathaniel Borenstein, Issac Chan, Lutz
741
+ Donnerhacke, Paul Eggert, Ned Freed, Andreas M. Kirchwitz, Olle
742
+ Jarnefors, Mike Rosin, Yutaka Sato, Bart Schaefer, and Kazuhiko
743
+ Yamamoto, for their helpful advice, insightful comments, and
744
+ illuminating questions in response to earlier versions of this
745
+ specification.
746
+
747
+ 12. Author's Address
748
+
749
+ Keith Moore
750
+ University of Tennessee
751
+ 107 Ayres Hall
752
+ Knoxville TN 37996-1301
753
+
754
+ EMail: moore@cs.utk.edu
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+ Moore Standards Track [Page 14]
786
+
787
+ RFC 2047 Message Header Extensions November 1996
788
+
789
+
790
+ Appendix - changes since RFC 1522 (in no particular order)
791
+
792
+ + explicitly state that the MIME-Version is not requried to use
793
+ 'encoded-word's.
794
+
795
+ + add explicit note that SPACEs and TABs are not allowed within
796
+ 'encoded-word's, explaining that an 'encoded-word' must look like an
797
+ 'atom' to an RFC822 parser.values, to be precise).
798
+
799
+ + add examples from Olle Jarnefors (thanks!) which illustrate how
800
+ encoded-words with adjacent linear-white-space are displayed.
801
+
802
+ + explicitly list terms defined in RFC822 and referenced in this memo
803
+
804
+ + fix transcription typos that caused one or two lines and a couple of
805
+ characters to disappear in the resulting text, due to nroff quirks.
806
+
807
+ + clarify that encoded-words are allowed in '*text' fields in both
808
+ RFC822 headers and MIME body part headers, but NOT as parameter
809
+ values.
810
+
811
+ + clarify the requirement to switch back to ASCII within the encoded
812
+ portion of an 'encoded-word', for any charset that uses code switching
813
+ sequences.
814
+
815
+ + add a note about 'encoded-word's being delimited by "(" and ")"
816
+ within a comment, but not in a *text (how bizarre!).
817
+
818
+ + fix the Andre Pirard example to get rid of the trailing "_" after
819
+ the =E9. (no longer needed post-1342).
820
+
821
+ + clarification: an 'encoded-word' may appear immediately following
822
+ the initial "(" or immediately before the final ")" that delimits a
823
+ comment, not just adjacent to "(" and ")" *within* *ctext.
824
+
825
+ + add a note to explain that a "B" 'encoded-word' will always have a
826
+ multiple of 4 characters in the 'encoded-text' portion.
827
+
828
+ + add note about the "=" in the examples
829
+
830
+ + note that processing of 'encoded-word's occurs *after* parsing, and
831
+ some of the implications thereof.
832
+
833
+ + explicitly state that you can't expect to translate between
834
+ 1522 and either vanilla 822 or so-called "8-bit headers".
835
+
836
+ + explicitly state that 'encoded-word's are not valid within a
837
+ 'quoted-string'.
838
+
839
+
840
+
841
+ Moore Standards Track [Page 15]
842
+
843
+