rack-mail_exception 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.rdoc +38 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/lib/rack/mail_exception.rb +103 -0
- data/test/helper.rb +13 -0
- data/test/test_rack_mail_exception.rb +93 -0
- data/vendor/mail/.bundle/config +2 -0
- data/vendor/mail/CHANGELOG.rdoc +370 -0
- data/vendor/mail/Dependencies.txt +3 -0
- data/vendor/mail/Gemfile +17 -0
- data/vendor/mail/README.rdoc +572 -0
- data/vendor/mail/ROADMAP +92 -0
- data/vendor/mail/Rakefile +41 -0
- data/vendor/mail/TODO.rdoc +9 -0
- data/vendor/mail/lib/mail.rb +76 -0
- data/vendor/mail/lib/mail/attachments_list.rb +99 -0
- data/vendor/mail/lib/mail/body.rb +287 -0
- data/vendor/mail/lib/mail/configuration.rb +67 -0
- data/vendor/mail/lib/mail/core_extensions/blank.rb +26 -0
- data/vendor/mail/lib/mail/core_extensions/nil.rb +11 -0
- data/vendor/mail/lib/mail/core_extensions/string.rb +27 -0
- data/vendor/mail/lib/mail/elements.rb +14 -0
- data/vendor/mail/lib/mail/elements/address.rb +306 -0
- data/vendor/mail/lib/mail/elements/address_list.rb +74 -0
- data/vendor/mail/lib/mail/elements/content_disposition_element.rb +30 -0
- data/vendor/mail/lib/mail/elements/content_location_element.rb +25 -0
- data/vendor/mail/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
- data/vendor/mail/lib/mail/elements/content_type_element.rb +35 -0
- data/vendor/mail/lib/mail/elements/date_time_element.rb +26 -0
- data/vendor/mail/lib/mail/elements/envelope_from_element.rb +34 -0
- data/vendor/mail/lib/mail/elements/message_ids_element.rb +29 -0
- data/vendor/mail/lib/mail/elements/mime_version_element.rb +26 -0
- data/vendor/mail/lib/mail/elements/phrase_list.rb +21 -0
- data/vendor/mail/lib/mail/elements/received_element.rb +30 -0
- data/vendor/mail/lib/mail/encodings.rb +258 -0
- data/vendor/mail/lib/mail/encodings/7bit.rb +31 -0
- data/vendor/mail/lib/mail/encodings/8bit.rb +31 -0
- data/vendor/mail/lib/mail/encodings/base64.rb +33 -0
- data/vendor/mail/lib/mail/encodings/binary.rb +31 -0
- data/vendor/mail/lib/mail/encodings/quoted_printable.rb +38 -0
- data/vendor/mail/lib/mail/encodings/transfer_encoding.rb +58 -0
- data/vendor/mail/lib/mail/envelope.rb +35 -0
- data/vendor/mail/lib/mail/field.rb +223 -0
- data/vendor/mail/lib/mail/field_list.rb +33 -0
- data/vendor/mail/lib/mail/fields.rb +35 -0
- data/vendor/mail/lib/mail/fields/bcc_field.rb +56 -0
- data/vendor/mail/lib/mail/fields/cc_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/comments_field.rb +41 -0
- data/vendor/mail/lib/mail/fields/common/address_container.rb +16 -0
- data/vendor/mail/lib/mail/fields/common/common_address.rb +125 -0
- data/vendor/mail/lib/mail/fields/common/common_date.rb +42 -0
- data/vendor/mail/lib/mail/fields/common/common_field.rb +50 -0
- data/vendor/mail/lib/mail/fields/common/common_message_id.rb +43 -0
- data/vendor/mail/lib/mail/fields/common/parameter_hash.rb +52 -0
- data/vendor/mail/lib/mail/fields/content_description_field.rb +19 -0
- data/vendor/mail/lib/mail/fields/content_disposition_field.rb +69 -0
- data/vendor/mail/lib/mail/fields/content_id_field.rb +63 -0
- data/vendor/mail/lib/mail/fields/content_location_field.rb +42 -0
- data/vendor/mail/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
- data/vendor/mail/lib/mail/fields/content_type_field.rb +185 -0
- data/vendor/mail/lib/mail/fields/date_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/from_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/in_reply_to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/keywords_field.rb +44 -0
- data/vendor/mail/lib/mail/fields/message_id_field.rb +83 -0
- data/vendor/mail/lib/mail/fields/mime_version_field.rb +53 -0
- data/vendor/mail/lib/mail/fields/optional_field.rb +13 -0
- data/vendor/mail/lib/mail/fields/received_field.rb +67 -0
- data/vendor/mail/lib/mail/fields/references_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/reply_to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_bcc_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_cc_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_date_field.rb +35 -0
- data/vendor/mail/lib/mail/fields/resent_from_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/resent_message_id_field.rb +34 -0
- data/vendor/mail/lib/mail/fields/resent_sender_field.rb +62 -0
- data/vendor/mail/lib/mail/fields/resent_to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/return_path_field.rb +64 -0
- data/vendor/mail/lib/mail/fields/sender_field.rb +67 -0
- data/vendor/mail/lib/mail/fields/structured_field.rb +51 -0
- data/vendor/mail/lib/mail/fields/subject_field.rb +16 -0
- data/vendor/mail/lib/mail/fields/to_field.rb +55 -0
- data/vendor/mail/lib/mail/fields/unstructured_field.rb +166 -0
- data/vendor/mail/lib/mail/header.rb +262 -0
- data/vendor/mail/lib/mail/mail.rb +234 -0
- data/vendor/mail/lib/mail/message.rb +1867 -0
- data/vendor/mail/lib/mail/network.rb +9 -0
- data/vendor/mail/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
- data/vendor/mail/lib/mail/network/delivery_methods/sendmail.rb +62 -0
- data/vendor/mail/lib/mail/network/delivery_methods/smtp.rb +110 -0
- data/vendor/mail/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
- data/vendor/mail/lib/mail/network/retriever_methods/imap.rb +18 -0
- data/vendor/mail/lib/mail/network/retriever_methods/pop3.rb +149 -0
- data/vendor/mail/lib/mail/parsers/address_lists.rb +64 -0
- data/vendor/mail/lib/mail/parsers/address_lists.treetop +19 -0
- data/vendor/mail/lib/mail/parsers/content_disposition.rb +387 -0
- data/vendor/mail/lib/mail/parsers/content_disposition.treetop +46 -0
- data/vendor/mail/lib/mail/parsers/content_location.rb +139 -0
- data/vendor/mail/lib/mail/parsers/content_location.treetop +20 -0
- data/vendor/mail/lib/mail/parsers/content_transfer_encoding.rb +162 -0
- data/vendor/mail/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
- data/vendor/mail/lib/mail/parsers/content_type.rb +539 -0
- data/vendor/mail/lib/mail/parsers/content_type.treetop +58 -0
- data/vendor/mail/lib/mail/parsers/date_time.rb +114 -0
- data/vendor/mail/lib/mail/parsers/date_time.treetop +11 -0
- data/vendor/mail/lib/mail/parsers/envelope_from.rb +194 -0
- data/vendor/mail/lib/mail/parsers/envelope_from.treetop +32 -0
- data/vendor/mail/lib/mail/parsers/message_ids.rb +45 -0
- data/vendor/mail/lib/mail/parsers/message_ids.treetop +15 -0
- data/vendor/mail/lib/mail/parsers/mime_version.rb +144 -0
- data/vendor/mail/lib/mail/parsers/mime_version.treetop +19 -0
- data/vendor/mail/lib/mail/parsers/phrase_lists.rb +45 -0
- data/vendor/mail/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/vendor/mail/lib/mail/parsers/received.rb +71 -0
- data/vendor/mail/lib/mail/parsers/received.treetop +11 -0
- data/vendor/mail/lib/mail/parsers/rfc2045.rb +464 -0
- data/vendor/mail/lib/mail/parsers/rfc2045.treetop +36 -0
- data/vendor/mail/lib/mail/parsers/rfc2822.rb +5318 -0
- data/vendor/mail/lib/mail/parsers/rfc2822.treetop +410 -0
- data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.rb +3757 -0
- data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/vendor/mail/lib/mail/part.rb +102 -0
- data/vendor/mail/lib/mail/parts_list.rb +34 -0
- data/vendor/mail/lib/mail/patterns.rb +30 -0
- data/vendor/mail/lib/mail/utilities.rb +181 -0
- data/vendor/mail/lib/mail/version.rb +10 -0
- data/vendor/mail/lib/mail/version_specific/ruby_1_8.rb +97 -0
- data/vendor/mail/lib/mail/version_specific/ruby_1_9.rb +87 -0
- data/vendor/mail/lib/tasks/corpus.rake +125 -0
- data/vendor/mail/lib/tasks/treetop.rake +10 -0
- data/vendor/mail/mail.gemspec +20 -0
- data/vendor/mail/reference/US ASCII Table.txt +130 -0
- data/vendor/mail/reference/rfc1035 Domain Implementation and Specification.txt +3083 -0
- data/vendor/mail/reference/rfc1049 Content-Type Header Field for Internet Messages.txt +451 -0
- data/vendor/mail/reference/rfc1344 Implications of MIME for Internet Mail Gateways.txt +586 -0
- data/vendor/mail/reference/rfc1345 Character Mnemonics & Character Sets.txt +5761 -0
- data/vendor/mail/reference/rfc1524 A User Agent Configuration Mechanism For Multimedia Mail Format Information.txt +675 -0
- data/vendor/mail/reference/rfc1652 SMTP Service Extension for 8bit-MIMEtransport.txt +339 -0
- data/vendor/mail/reference/rfc1892 Multipart Report .txt +227 -0
- data/vendor/mail/reference/rfc1893 Mail System Status Codes.txt +843 -0
- data/vendor/mail/reference/rfc2045 Multipurpose Internet Mail Extensions (1).txt +1739 -0
- data/vendor/mail/reference/rfc2046 Multipurpose Internet Mail Extensions (2).txt +2467 -0
- data/vendor/mail/reference/rfc2047 Multipurpose Internet Mail Extensions (3).txt +843 -0
- data/vendor/mail/reference/rfc2048 Multipurpose Internet Mail Extensions (4).txt +1180 -0
- data/vendor/mail/reference/rfc2049 Multipurpose Internet Mail Extensions (5).txt +1347 -0
- data/vendor/mail/reference/rfc2111 Content-ID and Message-ID URLs.txt +283 -0
- data/vendor/mail/reference/rfc2183 Content-Disposition Header Field.txt +675 -0
- data/vendor/mail/reference/rfc2231 MIME Parameter Value and Encoded Word Extensions.txt +563 -0
- data/vendor/mail/reference/rfc2387 MIME Multipart-Related Content-type.txt +563 -0
- data/vendor/mail/reference/rfc2821 Simple Mail Transfer Protocol.txt +3711 -0
- data/vendor/mail/reference/rfc2822 Internet Message Format.txt +2859 -0
- data/vendor/mail/reference/rfc3462 Reporting of Mail System Administrative Messages.txt +396 -0
- data/vendor/mail/reference/rfc3696 Checking and Transformation of Names.txt +898 -0
- data/vendor/mail/reference/rfc4155 The application-mbox Media Type.txt +502 -0
- data/vendor/mail/reference/rfc4234 Augmented BNF for Syntax Specifications: ABNF.txt +899 -0
- data/vendor/mail/reference/rfc822 Standard for the Format of ARPA Internet Text Messages.txt +2900 -0
- data/vendor/mail/spec/environment.rb +15 -0
- data/vendor/mail/spec/features/making_a_new_message.feature +14 -0
- data/vendor/mail/spec/features/steps/env.rb +6 -0
- data/vendor/mail/spec/features/steps/making_a_new_message_steps.rb +11 -0
- data/vendor/mail/spec/fixtures/attachments/basic_email.eml +31 -0
- data/vendor/mail/spec/fixtures/attachments/test.gif +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.jpg +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.pdf +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.png +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.tiff +0 -0
- data/vendor/mail/spec/fixtures/attachments/test.zip +0 -0
- data/vendor/mail/spec/fixtures/attachments//343/201/246/343/201/231/343/201/250.txt +2 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_disposition.eml +29 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_location.eml +32 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_message_rfc822.eml +92 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_only_email.eml +17 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_pdf.eml +70 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_encoded_name.eml +47 -0
- data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_quoted_filename.eml +60 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/cant_parse_from.eml +33 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_7-bit.eml +231 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_empty.eml +33 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_plain.eml +148 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_qp_with_space.eml +53 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_spam.eml +44 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_text-html.eml +50 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_8bits.eml +770 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_semi_colon.eml +269 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_x_uuencode.eml +79 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/empty_group_lists.eml +162 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/header_fields_with_empty_values.eml +33 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/missing_body.eml +16 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/missing_content_disposition.eml +43 -0
- data/vendor/mail/spec/fixtures/emails/error_emails/multiple_content_types.eml +25 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email11.eml +34 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email12.eml +32 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email2.eml +114 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email4.eml +59 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email7.eml +66 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_encoded_stack_level_too_deep.eml +53 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_illegal_boundary.eml +58 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_mimepart_without_content_type.eml +94 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_multipart_mixed_quoted_boundary.eml +50 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_nested_attachment.eml +100 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_quoted_illegal_boundary.eml +58 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/sig_only_email.eml +29 -0
- data/vendor/mail/spec/fixtures/emails/mime_emails/two_from_in_message.eml +42 -0
- data/vendor/mail/spec/fixtures/emails/multi_charset/japanese.eml +9 -0
- data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment.eml +27 -0
- data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment_long_name.eml +44 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce1.eml +179 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce2.eml +179 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_422.eml +98 -0
- data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_530.eml +97 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/basic_email.eml +31 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email10.eml +20 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email5.eml +19 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email6.eml +20 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email8.eml +47 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_bad_time.eml +62 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_double_at_in_header.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_incorrect_header.eml +28 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_multiple_from.eml +30 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_quoted_with_0d0a.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_reply.eml +32 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_simple.eml +11 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_string_in_date_field.eml +17 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_trailing_dot.eml +21 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_bad_date.eml +48 -0
- data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_partially_quoted_subject.eml +14 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example01.eml +8 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example02.eml +9 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example03.eml +7 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example04.eml +7 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example05.eml +8 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example06.eml +10 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example07.eml +9 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example08.eml +12 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example09.eml +15 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example10.eml +15 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example11.eml +6 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example12.eml +8 -0
- data/vendor/mail/spec/fixtures/emails/rfc2822/example13.eml +10 -0
- data/vendor/mail/spec/fixtures/emails/sample_output_multipart +0 -0
- data/vendor/mail/spec/mail/attachments_list_spec.rb +214 -0
- data/vendor/mail/spec/mail/body_spec.rb +385 -0
- data/vendor/mail/spec/mail/configuration_spec.rb +19 -0
- data/vendor/mail/spec/mail/core_extensions/string_spec.rb +62 -0
- data/vendor/mail/spec/mail/core_extensions_spec.rb +99 -0
- data/vendor/mail/spec/mail/elements/address_list_spec.rb +109 -0
- data/vendor/mail/spec/mail/elements/address_spec.rb +609 -0
- data/vendor/mail/spec/mail/elements/date_time_element_spec.rb +20 -0
- data/vendor/mail/spec/mail/elements/envelope_from_element_spec.rb +31 -0
- data/vendor/mail/spec/mail/elements/message_ids_element_spec.rb +43 -0
- data/vendor/mail/spec/mail/elements/phrase_list_spec.rb +22 -0
- data/vendor/mail/spec/mail/elements/received_element_spec.rb +34 -0
- data/vendor/mail/spec/mail/encoding_spec.rb +189 -0
- data/vendor/mail/spec/mail/encodings/base64_spec.rb +25 -0
- data/vendor/mail/spec/mail/encodings/quoted_printable_spec.rb +25 -0
- data/vendor/mail/spec/mail/encodings_spec.rb +664 -0
- data/vendor/mail/spec/mail/example_emails_spec.rb +303 -0
- data/vendor/mail/spec/mail/field_list_spec.rb +33 -0
- data/vendor/mail/spec/mail/field_spec.rb +198 -0
- data/vendor/mail/spec/mail/fields/bcc_field_spec.rb +89 -0
- data/vendor/mail/spec/mail/fields/cc_field_spec.rb +79 -0
- data/vendor/mail/spec/mail/fields/comments_field_spec.rb +25 -0
- data/vendor/mail/spec/mail/fields/common/address_container_spec.rb +18 -0
- data/vendor/mail/spec/mail/fields/common/common_address_spec.rb +132 -0
- data/vendor/mail/spec/mail/fields/common/common_date_spec.rb +25 -0
- data/vendor/mail/spec/mail/fields/common/common_field_spec.rb +69 -0
- data/vendor/mail/spec/mail/fields/common/common_message_id_spec.rb +30 -0
- data/vendor/mail/spec/mail/fields/common/parameter_hash_spec.rb +56 -0
- data/vendor/mail/spec/mail/fields/content_description_field_spec.rb +39 -0
- data/vendor/mail/spec/mail/fields/content_disposition_field_spec.rb +55 -0
- data/vendor/mail/spec/mail/fields/content_id_field_spec.rb +117 -0
- data/vendor/mail/spec/mail/fields/content_location_field_spec.rb +46 -0
- data/vendor/mail/spec/mail/fields/content_transfer_encoding_field_spec.rb +113 -0
- data/vendor/mail/spec/mail/fields/content_type_field_spec.rb +678 -0
- data/vendor/mail/spec/mail/fields/date_field_spec.rb +73 -0
- data/vendor/mail/spec/mail/fields/envelope_spec.rb +48 -0
- data/vendor/mail/spec/mail/fields/from_field_spec.rb +89 -0
- data/vendor/mail/spec/mail/fields/in_reply_to_field_spec.rb +62 -0
- data/vendor/mail/spec/mail/fields/keywords_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/message_id_field_spec.rb +147 -0
- data/vendor/mail/spec/mail/fields/mime_version_field_spec.rb +166 -0
- data/vendor/mail/spec/mail/fields/received_field_spec.rb +44 -0
- data/vendor/mail/spec/mail/fields/references_field_spec.rb +35 -0
- data/vendor/mail/spec/mail/fields/reply_to_field_spec.rb +67 -0
- data/vendor/mail/spec/mail/fields/resent_bcc_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/resent_cc_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/resent_date_field_spec.rb +39 -0
- data/vendor/mail/spec/mail/fields/resent_from_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/resent_message_id_field_spec.rb +24 -0
- data/vendor/mail/spec/mail/fields/resent_sender_field_spec.rb +58 -0
- data/vendor/mail/spec/mail/fields/resent_to_field_spec.rb +66 -0
- data/vendor/mail/spec/mail/fields/return_path_field_spec.rb +52 -0
- data/vendor/mail/spec/mail/fields/sender_field_spec.rb +58 -0
- data/vendor/mail/spec/mail/fields/structured_field_spec.rb +72 -0
- data/vendor/mail/spec/mail/fields/to_field_spec.rb +92 -0
- data/vendor/mail/spec/mail/fields/unstructured_field_spec.rb +134 -0
- data/vendor/mail/spec/mail/header_spec.rb +578 -0
- data/vendor/mail/spec/mail/mail_spec.rb +34 -0
- data/vendor/mail/spec/mail/message_spec.rb +1409 -0
- data/vendor/mail/spec/mail/mime_messages_spec.rb +435 -0
- data/vendor/mail/spec/mail/multipart_report_spec.rb +112 -0
- data/vendor/mail/spec/mail/network/delivery_methods/file_delivery_spec.rb +79 -0
- data/vendor/mail/spec/mail/network/delivery_methods/sendmail_spec.rb +125 -0
- data/vendor/mail/spec/mail/network/delivery_methods/smtp_spec.rb +133 -0
- data/vendor/mail/spec/mail/network/delivery_methods/test_mailer_spec.rb +57 -0
- data/vendor/mail/spec/mail/network/retriever_methods/pop3_spec.rb +180 -0
- data/vendor/mail/spec/mail/network_spec.rb +359 -0
- data/vendor/mail/spec/mail/parsers/address_lists_parser_spec.rb +15 -0
- data/vendor/mail/spec/mail/parsers/content_transfer_encoding_parser_spec.rb +72 -0
- data/vendor/mail/spec/mail/part_spec.rb +129 -0
- data/vendor/mail/spec/mail/parts_list_spec.rb +12 -0
- data/vendor/mail/spec/mail/round_tripping_spec.rb +44 -0
- data/vendor/mail/spec/mail/utilities_spec.rb +327 -0
- data/vendor/mail/spec/mail/version_specific/escape_paren_1_8_spec.rb +32 -0
- data/vendor/mail/spec/matchers/break_down_to.rb +35 -0
- data/vendor/mail/spec/spec_helper.rb +163 -0
- metadata +442 -0
@@ -0,0 +1,3711 @@
|
|
1
|
+
Network Working Group J. Klensin, Editor
|
2
|
+
Request for Comments: 2821 AT&T Laboratories
|
3
|
+
Obsoletes: 821, 974, 1869 April 2001
|
4
|
+
Updates: 1123
|
5
|
+
Category: Standards Track
|
6
|
+
|
7
|
+
Simple Mail Transfer Protocol
|
8
|
+
|
9
|
+
Status of this Memo
|
10
|
+
|
11
|
+
This document specifies an Internet standards track protocol for the
|
12
|
+
Internet community, and requests discussion and suggestions for
|
13
|
+
improvements. Please refer to the current edition of the "Internet
|
14
|
+
Official Protocol Standards" (STD 1) for the standardization state
|
15
|
+
and status of this protocol. Distribution of this memo is unlimited.
|
16
|
+
|
17
|
+
Copyright Notice
|
18
|
+
|
19
|
+
Copyright (C) The Internet Society (2001). All Rights Reserved.
|
20
|
+
|
21
|
+
Abstract
|
22
|
+
|
23
|
+
This document is a self-contained specification of the basic protocol
|
24
|
+
for the Internet electronic mail transport. It consolidates, updates
|
25
|
+
and clarifies, but doesn't add new or change existing functionality
|
26
|
+
of the following:
|
27
|
+
|
28
|
+
- the original SMTP (Simple Mail Transfer Protocol) specification of
|
29
|
+
RFC 821 [30],
|
30
|
+
|
31
|
+
- domain name system requirements and implications for mail
|
32
|
+
transport from RFC 1035 [22] and RFC 974 [27],
|
33
|
+
|
34
|
+
- the clarifications and applicability statements in RFC 1123 [2],
|
35
|
+
and
|
36
|
+
|
37
|
+
- material drawn from the SMTP Extension mechanisms [19].
|
38
|
+
|
39
|
+
It obsoletes RFC 821, RFC 974, and updates RFC 1123 (replaces the
|
40
|
+
mail transport materials of RFC 1123). However, RFC 821 specifies
|
41
|
+
some features that were not in significant use in the Internet by the
|
42
|
+
mid-1990s and (in appendices) some additional transport models.
|
43
|
+
Those sections are omitted here in the interest of clarity and
|
44
|
+
brevity; readers needing them should refer to RFC 821.
|
45
|
+
|
46
|
+
It also includes some additional material from RFC 1123 that required
|
47
|
+
amplification. This material has been identified in multiple ways,
|
48
|
+
mostly by tracking flaming on various lists and newsgroups and
|
49
|
+
problems of unusual readings or interpretations that have appeared as
|
50
|
+
the SMTP extensions have been deployed. Where this specification
|
51
|
+
moves beyond consolidation and actually differs from earlier
|
52
|
+
documents, it supersedes them technically as well as textually.
|
53
|
+
|
54
|
+
Although SMTP was designed as a mail transport and delivery protocol,
|
55
|
+
this specification also contains information that is important to its
|
56
|
+
use as a 'mail submission' protocol, as recommended for POP [3, 26]
|
57
|
+
and IMAP [6]. Additional submission issues are discussed in RFC 2476
|
58
|
+
[15].
|
59
|
+
|
60
|
+
Section 2.3 provides definitions of terms specific to this document.
|
61
|
+
Except when the historical terminology is necessary for clarity, this
|
62
|
+
document uses the current 'client' and 'server' terminology to
|
63
|
+
identify the sending and receiving SMTP processes, respectively.
|
64
|
+
|
65
|
+
A companion document [32] discusses message headers, message bodies
|
66
|
+
and formats and structures for them, and their relationship.
|
67
|
+
|
68
|
+
Table of Contents
|
69
|
+
|
70
|
+
1. Introduction .................................................. 4
|
71
|
+
2. The SMTP Model ................................................ 5
|
72
|
+
2.1 Basic Structure .............................................. 5
|
73
|
+
2.2 The Extension Model .......................................... 7
|
74
|
+
2.2.1 Background ................................................. 7
|
75
|
+
2.2.2 Definition and Registration of Extensions .................. 8
|
76
|
+
2.3 Terminology .................................................. 9
|
77
|
+
2.3.1 Mail Objects ............................................... 10
|
78
|
+
2.3.2 Senders and Receivers ...................................... 10
|
79
|
+
2.3.3 Mail Agents and Message Stores ............................. 10
|
80
|
+
2.3.4 Host ....................................................... 11
|
81
|
+
2.3.5 Domain ..................................................... 11
|
82
|
+
2.3.6 Buffer and State Table ..................................... 11
|
83
|
+
2.3.7 Lines ...................................................... 12
|
84
|
+
2.3.8 Originator, Delivery, Relay, and Gateway Systems ........... 12
|
85
|
+
2.3.9 Message Content and Mail Data .............................. 13
|
86
|
+
2.3.10 Mailbox and Address ....................................... 13
|
87
|
+
2.3.11 Reply ..................................................... 13
|
88
|
+
2.4 General Syntax Principles and Transaction Model .............. 13
|
89
|
+
3. The SMTP Procedures: An Overview .............................. 15
|
90
|
+
3.1 Session Initiation ........................................... 15
|
91
|
+
3.2 Client Initiation ............................................ 16
|
92
|
+
3.3 Mail Transactions ............................................ 16
|
93
|
+
3.4 Forwarding for Address Correction or Updating ................ 19
|
94
|
+
|
95
|
+
3.5 Commands for Debugging Addresses ............................. 20
|
96
|
+
3.5.1 Overview ................................................... 20
|
97
|
+
3.5.2 VRFY Normal Response ....................................... 22
|
98
|
+
3.5.3 Meaning of VRFY or EXPN Success Response ................... 22
|
99
|
+
3.5.4 Semantics and Applications of EXPN ......................... 23
|
100
|
+
3.6 Domains ...................................................... 23
|
101
|
+
3.7 Relaying ..................................................... 24
|
102
|
+
3.8 Mail Gatewaying .............................................. 25
|
103
|
+
3.8.1 Header Fields in Gatewaying ................................ 26
|
104
|
+
3.8.2 Received Lines in Gatewaying ............................... 26
|
105
|
+
3.8.3 Addresses in Gatewaying .................................... 26
|
106
|
+
3.8.4 Other Header Fields in Gatewaying .......................... 27
|
107
|
+
3.8.5 Envelopes in Gatewaying .................................... 27
|
108
|
+
3.9 Terminating Sessions and Connections ......................... 27
|
109
|
+
3.10 Mailing Lists and Aliases ................................... 28
|
110
|
+
3.10.1 Alias ..................................................... 28
|
111
|
+
3.10.2 List ...................................................... 28
|
112
|
+
4. The SMTP Specifications ....................................... 29
|
113
|
+
4.1 SMTP Commands ................................................ 29
|
114
|
+
4.1.1 Command Semantics and Syntax ............................... 29
|
115
|
+
4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO) ................... 29
|
116
|
+
4.1.1.2 MAIL (MAIL) .............................................. 31
|
117
|
+
4.1.1.3 RECIPIENT (RCPT) ......................................... 31
|
118
|
+
4.1.1.4 DATA (DATA) .............................................. 33
|
119
|
+
4.1.1.5 RESET (RSET) ............................................. 34
|
120
|
+
4.1.1.6 VERIFY (VRFY) ............................................ 35
|
121
|
+
4.1.1.7 EXPAND (EXPN) ............................................ 35
|
122
|
+
4.1.1.8 HELP (HELP) .............................................. 35
|
123
|
+
4.1.1.9 NOOP (NOOP) .............................................. 35
|
124
|
+
4.1.1.10 QUIT (QUIT) ............................................. 36
|
125
|
+
4.1.2 Command Argument Syntax .................................... 36
|
126
|
+
4.1.3 Address Literals ........................................... 38
|
127
|
+
4.1.4 Order of Commands .......................................... 39
|
128
|
+
4.1.5 Private-use Commands ....................................... 40
|
129
|
+
4.2 SMTP Replies ................................................ 40
|
130
|
+
4.2.1 Reply Code Severities and Theory ........................... 42
|
131
|
+
4.2.2 Reply Codes by Function Groups ............................. 44
|
132
|
+
4.2.3 Reply Codes in Numeric Order .............................. 45
|
133
|
+
4.2.4 Reply Code 502 ............................................. 46
|
134
|
+
4.2.5 Reply Codes After DATA and the Subsequent <CRLF>.<CRLF> .... 46
|
135
|
+
4.3 Sequencing of Commands and Replies ........................... 47
|
136
|
+
4.3.1 Sequencing Overview ........................................ 47
|
137
|
+
4.3.2 Command-Reply Sequences .................................... 48
|
138
|
+
4.4 Trace Information ............................................ 49
|
139
|
+
4.5 Additional Implementation Issues ............................. 53
|
140
|
+
4.5.1 Minimum Implementation ..................................... 53
|
141
|
+
4.5.2 Transparency ............................................... 53
|
142
|
+
4.5.3 Sizes and Timeouts ......................................... 54
|
143
|
+
|
144
|
+
4.5.3.1 Size limits and minimums ................................. 54
|
145
|
+
4.5.3.2 Timeouts ................................................. 56
|
146
|
+
4.5.4 Retry Strategies ........................................... 57
|
147
|
+
4.5.4.1 Sending Strategy ......................................... 58
|
148
|
+
4.5.4.2 Receiving Strategy ....................................... 59
|
149
|
+
4.5.5 Messages with a null reverse-path .......................... 59
|
150
|
+
5. Address Resolution and Mail Handling .......................... 60
|
151
|
+
6. Problem Detection and Handling ................................ 62
|
152
|
+
6.1 Reliable Delivery and Replies by Email ....................... 62
|
153
|
+
6.2 Loop Detection ............................................... 63
|
154
|
+
6.3 Compensating for Irregularities .............................. 63
|
155
|
+
7. Security Considerations ....................................... 64
|
156
|
+
7.1 Mail Security and Spoofing ................................... 64
|
157
|
+
7.2 "Blind" Copies ............................................... 65
|
158
|
+
7.3 VRFY, EXPN, and Security ..................................... 65
|
159
|
+
7.4 Information Disclosure in Announcements ...................... 66
|
160
|
+
7.5 Information Disclosure in Trace Fields ....................... 66
|
161
|
+
7.6 Information Disclosure in Message Forwarding ................. 67
|
162
|
+
7.7 Scope of Operation of SMTP Servers ........................... 67
|
163
|
+
8. IANA Considerations ........................................... 67
|
164
|
+
9. References .................................................... 68
|
165
|
+
10. Editor's Address ............................................. 70
|
166
|
+
11. Acknowledgments .............................................. 70
|
167
|
+
Appendices ....................................................... 71
|
168
|
+
A. TCP Transport Service ......................................... 71
|
169
|
+
B. Generating SMTP Commands from RFC 822 Headers ................. 71
|
170
|
+
C. Source Routes ................................................. 72
|
171
|
+
D. Scenarios ..................................................... 73
|
172
|
+
E. Other Gateway Issues .......................................... 76
|
173
|
+
F. Deprecated Features of RFC 821 ................................ 76
|
174
|
+
Full Copyright Statement ......................................... 79
|
175
|
+
|
176
|
+
1. Introduction
|
177
|
+
|
178
|
+
The objective of the Simple Mail Transfer Protocol (SMTP) is to
|
179
|
+
transfer mail reliably and efficiently.
|
180
|
+
|
181
|
+
SMTP is independent of the particular transmission subsystem and
|
182
|
+
requires only a reliable ordered data stream channel. While this
|
183
|
+
document specifically discusses transport over TCP, other transports
|
184
|
+
are possible. Appendices to RFC 821 describe some of them.
|
185
|
+
|
186
|
+
An important feature of SMTP is its capability to transport mail
|
187
|
+
across networks, usually referred to as "SMTP mail relaying" (see
|
188
|
+
section 3.8). A network consists of the mutually-TCP-accessible
|
189
|
+
hosts on the public Internet, the mutually-TCP-accessible hosts on a
|
190
|
+
firewall-isolated TCP/IP Intranet, or hosts in some other LAN or WAN
|
191
|
+
environment utilizing a non-TCP transport-level protocol. Using
|
192
|
+
|
193
|
+
SMTP, a process can transfer mail to another process on the same
|
194
|
+
network or to some other network via a relay or gateway process
|
195
|
+
accessible to both networks.
|
196
|
+
|
197
|
+
In this way, a mail message may pass through a number of intermediate
|
198
|
+
relay or gateway hosts on its path from sender to ultimate recipient.
|
199
|
+
The Mail eXchanger mechanisms of the domain name system [22, 27] (and
|
200
|
+
section 5 of this document) are used to identify the appropriate
|
201
|
+
next-hop destination for a message being transported.
|
202
|
+
|
203
|
+
2. The SMTP Model
|
204
|
+
|
205
|
+
2.1 Basic Structure
|
206
|
+
|
207
|
+
The SMTP design can be pictured as:
|
208
|
+
|
209
|
+
+----------+ +----------+
|
210
|
+
+------+ | | | |
|
211
|
+
| User |<-->| | SMTP | |
|
212
|
+
+------+ | Client- |Commands/Replies| Server- |
|
213
|
+
+------+ | SMTP |<-------------->| SMTP | +------+
|
214
|
+
| File |<-->| | and Mail | |<-->| File |
|
215
|
+
|System| | | | | |System|
|
216
|
+
+------+ +----------+ +----------+ +------+
|
217
|
+
SMTP client SMTP server
|
218
|
+
|
219
|
+
When an SMTP client has a message to transmit, it establishes a two-
|
220
|
+
way transmission channel to an SMTP server. The responsibility of an
|
221
|
+
SMTP client is to transfer mail messages to one or more SMTP servers,
|
222
|
+
or report its failure to do so.
|
223
|
+
|
224
|
+
The means by which a mail message is presented to an SMTP client, and
|
225
|
+
how that client determines the domain name(s) to which mail messages
|
226
|
+
are to be transferred is a local matter, and is not addressed by this
|
227
|
+
document. In some cases, the domain name(s) transferred to, or
|
228
|
+
determined by, an SMTP client will identify the final destination(s)
|
229
|
+
of the mail message. In other cases, common with SMTP clients
|
230
|
+
associated with implementations of the POP [3, 26] or IMAP [6]
|
231
|
+
protocols, or when the SMTP client is inside an isolated transport
|
232
|
+
service environment, the domain name determined will identify an
|
233
|
+
intermediate destination through which all mail messages are to be
|
234
|
+
relayed. SMTP clients that transfer all traffic, regardless of the
|
235
|
+
target domain names associated with the individual messages, or that
|
236
|
+
do not maintain queues for retrying message transmissions that
|
237
|
+
initially cannot be completed, may otherwise conform to this
|
238
|
+
specification but are not considered fully-capable. Fully-capable
|
239
|
+
SMTP implementations, including the relays used by these less capable
|
240
|
+
|
241
|
+
ones, and their destinations, are expected to support all of the
|
242
|
+
queuing, retrying, and alternate address functions discussed in this
|
243
|
+
specification.
|
244
|
+
|
245
|
+
The means by which an SMTP client, once it has determined a target
|
246
|
+
domain name, determines the identity of an SMTP server to which a
|
247
|
+
copy of a message is to be transferred, and then performs that
|
248
|
+
transfer, is covered by this document. To effect a mail transfer to
|
249
|
+
an SMTP server, an SMTP client establishes a two-way transmission
|
250
|
+
channel to that SMTP server. An SMTP client determines the address
|
251
|
+
of an appropriate host running an SMTP server by resolving a
|
252
|
+
destination domain name to either an intermediate Mail eXchanger host
|
253
|
+
or a final target host.
|
254
|
+
|
255
|
+
An SMTP server may be either the ultimate destination or an
|
256
|
+
intermediate "relay" (that is, it may assume the role of an SMTP
|
257
|
+
client after receiving the message) or "gateway" (that is, it may
|
258
|
+
transport the message further using some protocol other than SMTP).
|
259
|
+
SMTP commands are generated by the SMTP client and sent to the SMTP
|
260
|
+
server. SMTP replies are sent from the SMTP server to the SMTP
|
261
|
+
client in response to the commands.
|
262
|
+
|
263
|
+
In other words, message transfer can occur in a single connection
|
264
|
+
between the original SMTP-sender and the final SMTP-recipient, or can
|
265
|
+
occur in a series of hops through intermediary systems. In either
|
266
|
+
case, a formal handoff of responsibility for the message occurs: the
|
267
|
+
protocol requires that a server accept responsibility for either
|
268
|
+
delivering a message or properly reporting the failure to do so.
|
269
|
+
|
270
|
+
Once the transmission channel is established and initial handshaking
|
271
|
+
completed, the SMTP client normally initiates a mail transaction.
|
272
|
+
Such a transaction consists of a series of commands to specify the
|
273
|
+
originator and destination of the mail and transmission of the
|
274
|
+
message content (including any headers or other structure) itself.
|
275
|
+
When the same message is sent to multiple recipients, this protocol
|
276
|
+
encourages the transmission of only one copy of the data for all
|
277
|
+
recipients at the same destination (or intermediate relay) host.
|
278
|
+
|
279
|
+
The server responds to each command with a reply; replies may
|
280
|
+
indicate that the command was accepted, that additional commands are
|
281
|
+
expected, or that a temporary or permanent error condition exists.
|
282
|
+
Commands specifying the sender or recipients may include server-
|
283
|
+
permitted SMTP service extension requests as discussed in section
|
284
|
+
2.2. The dialog is purposely lock-step, one-at-a-time, although this
|
285
|
+
can be modified by mutually-agreed extension requests such as command
|
286
|
+
pipelining [13].
|
287
|
+
|
288
|
+
Once a given mail message has been transmitted, the client may either
|
289
|
+
request that the connection be shut down or may initiate other mail
|
290
|
+
transactions. In addition, an SMTP client may use a connection to an
|
291
|
+
SMTP server for ancillary services such as verification of email
|
292
|
+
addresses or retrieval of mailing list subscriber addresses.
|
293
|
+
|
294
|
+
As suggested above, this protocol provides mechanisms for the
|
295
|
+
transmission of mail. This transmission normally occurs directly
|
296
|
+
from the sending user's host to the receiving user's host when the
|
297
|
+
two hosts are connected to the same transport service. When they are
|
298
|
+
not connected to the same transport service, transmission occurs via
|
299
|
+
one or more relay SMTP servers. An intermediate host that acts as
|
300
|
+
either an SMTP relay or as a gateway into some other transmission
|
301
|
+
environment is usually selected through the use of the domain name
|
302
|
+
service (DNS) Mail eXchanger mechanism.
|
303
|
+
|
304
|
+
Usually, intermediate hosts are determined via the DNS MX record, not
|
305
|
+
by explicit "source" routing (see section 5 and appendices C and
|
306
|
+
F.2).
|
307
|
+
|
308
|
+
2.2 The Extension Model
|
309
|
+
|
310
|
+
2.2.1 Background
|
311
|
+
|
312
|
+
In an effort that started in 1990, approximately a decade after RFC
|
313
|
+
821 was completed, the protocol was modified with a "service
|
314
|
+
extensions" model that permits the client and server to agree to
|
315
|
+
utilize shared functionality beyond the original SMTP requirements.
|
316
|
+
The SMTP extension mechanism defines a means whereby an extended SMTP
|
317
|
+
client and server may recognize each other, and the server can inform
|
318
|
+
the client as to the service extensions that it supports.
|
319
|
+
|
320
|
+
Contemporary SMTP implementations MUST support the basic extension
|
321
|
+
mechanisms. For instance, servers MUST support the EHLO command even
|
322
|
+
if they do not implement any specific extensions and clients SHOULD
|
323
|
+
preferentially utilize EHLO rather than HELO. (However, for
|
324
|
+
compatibility with older conforming implementations, SMTP clients and
|
325
|
+
servers MUST support the original HELO mechanisms as a fallback.)
|
326
|
+
Unless the different characteristics of HELO must be identified for
|
327
|
+
interoperability purposes, this document discusses only EHLO.
|
328
|
+
|
329
|
+
SMTP is widely deployed and high-quality implementations have proven
|
330
|
+
to be very robust. However, the Internet community now considers
|
331
|
+
some services to be important that were not anticipated when the
|
332
|
+
protocol was first designed. If support for those services is to be
|
333
|
+
added, it must be done in a way that permits older implementations to
|
334
|
+
continue working acceptably. The extension framework consists of:
|
335
|
+
|
336
|
+
- The SMTP command EHLO, superseding the earlier HELO,
|
337
|
+
|
338
|
+
- a registry of SMTP service extensions,
|
339
|
+
|
340
|
+
- additional parameters to the SMTP MAIL and RCPT commands, and
|
341
|
+
|
342
|
+
- optional replacements for commands defined in this protocol, such
|
343
|
+
as for DATA in non-ASCII transmissions [33].
|
344
|
+
|
345
|
+
SMTP's strength comes primarily from its simplicity. Experience with
|
346
|
+
many protocols has shown that protocols with few options tend towards
|
347
|
+
ubiquity, whereas protocols with many options tend towards obscurity.
|
348
|
+
|
349
|
+
Each and every extension, regardless of its benefits, must be
|
350
|
+
carefully scrutinized with respect to its implementation, deployment,
|
351
|
+
and interoperability costs. In many cases, the cost of extending the
|
352
|
+
SMTP service will likely outweigh the benefit.
|
353
|
+
|
354
|
+
2.2.2 Definition and Registration of Extensions
|
355
|
+
|
356
|
+
The IANA maintains a registry of SMTP service extensions. A
|
357
|
+
corresponding EHLO keyword value is associated with each extension.
|
358
|
+
Each service extension registered with the IANA must be defined in a
|
359
|
+
formal standards-track or IESG-approved experimental protocol
|
360
|
+
document. The definition must include:
|
361
|
+
|
362
|
+
- the textual name of the SMTP service extension;
|
363
|
+
|
364
|
+
- the EHLO keyword value associated with the extension;
|
365
|
+
|
366
|
+
- the syntax and possible values of parameters associated with the
|
367
|
+
EHLO keyword value;
|
368
|
+
|
369
|
+
- any additional SMTP verbs associated with the extension
|
370
|
+
(additional verbs will usually be, but are not required to be, the
|
371
|
+
same as the EHLO keyword value);
|
372
|
+
|
373
|
+
- any new parameters the extension associates with the MAIL or RCPT
|
374
|
+
verbs;
|
375
|
+
|
376
|
+
- a description of how support for the extension affects the
|
377
|
+
behavior of a server and client SMTP; and,
|
378
|
+
|
379
|
+
- the increment by which the extension is increasing the maximum
|
380
|
+
length of the commands MAIL and/or RCPT, over that specified in
|
381
|
+
this standard.
|
382
|
+
|
383
|
+
In addition, any EHLO keyword value starting with an upper or lower
|
384
|
+
case "X" refers to a local SMTP service extension used exclusively
|
385
|
+
through bilateral agreement. Keywords beginning with "X" MUST NOT be
|
386
|
+
used in a registered service extension. Conversely, keyword values
|
387
|
+
presented in the EHLO response that do not begin with "X" MUST
|
388
|
+
correspond to a standard, standards-track, or IESG-approved
|
389
|
+
experimental SMTP service extension registered with IANA. A
|
390
|
+
conforming server MUST NOT offer non-"X"-prefixed keyword values that
|
391
|
+
are not described in a registered extension.
|
392
|
+
|
393
|
+
Additional verbs and parameter names are bound by the same rules as
|
394
|
+
EHLO keywords; specifically, verbs beginning with "X" are local
|
395
|
+
extensions that may not be registered or standardized. Conversely,
|
396
|
+
verbs not beginning with "X" must always be registered.
|
397
|
+
|
398
|
+
2.3 Terminology
|
399
|
+
|
400
|
+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
401
|
+
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
|
402
|
+
document are to be interpreted as described below.
|
403
|
+
|
404
|
+
1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that
|
405
|
+
the definition is an absolute requirement of the specification.
|
406
|
+
|
407
|
+
2. MUST NOT This phrase, or the phrase "SHALL NOT", mean that the
|
408
|
+
definition is an absolute prohibition of the specification.
|
409
|
+
|
410
|
+
3. SHOULD This word, or the adjective "RECOMMENDED", mean that
|
411
|
+
there may exist valid reasons in particular circumstances to
|
412
|
+
ignore a particular item, but the full implications must be
|
413
|
+
understood and carefully weighed before choosing a different
|
414
|
+
course.
|
415
|
+
|
416
|
+
4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean
|
417
|
+
that there may exist valid reasons in particular circumstances
|
418
|
+
when the particular behavior is acceptable or even useful, but the
|
419
|
+
full implications should be understood and the case carefully
|
420
|
+
weighed before implementing any behavior described with this
|
421
|
+
label.
|
422
|
+
|
423
|
+
5. MAY This word, or the adjective "OPTIONAL", mean that an item is
|
424
|
+
truly optional. One vendor may choose to include the item because
|
425
|
+
a particular marketplace requires it or because the vendor feels
|
426
|
+
that it enhances the product while another vendor may omit the
|
427
|
+
same item. An implementation which does not include a particular
|
428
|
+
option MUST be prepared to interoperate with another
|
429
|
+
implementation which does include the option, though perhaps with
|
430
|
+
reduced functionality. In the same vein an implementation which
|
431
|
+
|
432
|
+
does include a particular option MUST be prepared to interoperate
|
433
|
+
with another implementation which does not include the option
|
434
|
+
(except, of course, for the feature the option provides.)
|
435
|
+
|
436
|
+
2.3.1 Mail Objects
|
437
|
+
|
438
|
+
SMTP transports a mail object. A mail object contains an envelope
|
439
|
+
and content.
|
440
|
+
|
441
|
+
The SMTP envelope is sent as a series of SMTP protocol units
|
442
|
+
(described in section 3). It consists of an originator address (to
|
443
|
+
which error reports should be directed); one or more recipient
|
444
|
+
addresses; and optional protocol extension material. Historically,
|
445
|
+
variations on the recipient address specification command (RCPT TO)
|
446
|
+
could be used to specify alternate delivery modes, such as immediate
|
447
|
+
display; those variations have now been deprecated (see appendix F,
|
448
|
+
section F.6).
|
449
|
+
|
450
|
+
The SMTP content is sent in the SMTP DATA protocol unit and has two
|
451
|
+
parts: the headers and the body. If the content conforms to other
|
452
|
+
contemporary standards, the headers form a collection of field/value
|
453
|
+
pairs structured as in the message format specification [32]; the
|
454
|
+
body, if structured, is defined according to MIME [12]. The content
|
455
|
+
is textual in nature, expressed using the US-ASCII repertoire [1].
|
456
|
+
Although SMTP extensions (such as "8BITMIME" [20]) may relax this
|
457
|
+
restriction for the content body, the content headers are always
|
458
|
+
encoded using the US-ASCII repertoire. A MIME extension [23] defines
|
459
|
+
an algorithm for representing header values outside the US-ASCII
|
460
|
+
repertoire, while still encoding them using the US-ASCII repertoire.
|
461
|
+
|
462
|
+
2.3.2 Senders and Receivers
|
463
|
+
|
464
|
+
In RFC 821, the two hosts participating in an SMTP transaction were
|
465
|
+
described as the "SMTP-sender" and "SMTP-receiver". This document
|
466
|
+
has been changed to reflect current industry terminology and hence
|
467
|
+
refers to them as the "SMTP client" (or sometimes just "the client")
|
468
|
+
and "SMTP server" (or just "the server"), respectively. Since a
|
469
|
+
given host may act both as server and client in a relay situation,
|
470
|
+
"receiver" and "sender" terminology is still used where needed for
|
471
|
+
clarity.
|
472
|
+
|
473
|
+
2.3.3 Mail Agents and Message Stores
|
474
|
+
|
475
|
+
Additional mail system terminology became common after RFC 821 was
|
476
|
+
published and, where convenient, is used in this specification. In
|
477
|
+
particular, SMTP servers and clients provide a mail transport service
|
478
|
+
and therefore act as "Mail Transfer Agents" (MTAs). "Mail User
|
479
|
+
Agents" (MUAs or UAs) are normally thought of as the sources and
|
480
|
+
|
481
|
+
targets of mail. At the source, an MUA might collect mail to be
|
482
|
+
transmitted from a user and hand it off to an MTA; the final
|
483
|
+
("delivery") MTA would be thought of as handing the mail off to an
|
484
|
+
MUA (or at least transferring responsibility to it, e.g., by
|
485
|
+
depositing the message in a "message store"). However, while these
|
486
|
+
terms are used with at least the appearance of great precision in
|
487
|
+
other environments, the implied boundaries between MUAs and MTAs
|
488
|
+
often do not accurately match common, and conforming, practices with
|
489
|
+
Internet mail. Hence, the reader should be cautious about inferring
|
490
|
+
the strong relationships and responsibilities that might be implied
|
491
|
+
if these terms were used elsewhere.
|
492
|
+
|
493
|
+
2.3.4 Host
|
494
|
+
|
495
|
+
For the purposes of this specification, a host is a computer system
|
496
|
+
attached to the Internet (or, in some cases, to a private TCP/IP
|
497
|
+
network) and supporting the SMTP protocol. Hosts are known by names
|
498
|
+
(see "domain"); identifying them by numerical address is discouraged.
|
499
|
+
|
500
|
+
2.3.5 Domain
|
501
|
+
|
502
|
+
A domain (or domain name) consists of one or more dot-separated
|
503
|
+
components. These components ("labels" in DNS terminology [22]) are
|
504
|
+
restricted for SMTP purposes to consist of a sequence of letters,
|
505
|
+
digits, and hyphens drawn from the ASCII character set [1]. Domain
|
506
|
+
names are used as names of hosts and of other entities in the domain
|
507
|
+
name hierarchy. For example, a domain may refer to an alias (label
|
508
|
+
of a CNAME RR) or the label of Mail eXchanger records to be used to
|
509
|
+
deliver mail instead of representing a host name. See [22] and
|
510
|
+
section 5 of this specification.
|
511
|
+
|
512
|
+
The domain name, as described in this document and in [22], is the
|
513
|
+
entire, fully-qualified name (often referred to as an "FQDN"). A
|
514
|
+
domain name that is not in FQDN form is no more than a local alias.
|
515
|
+
Local aliases MUST NOT appear in any SMTP transaction.
|
516
|
+
|
517
|
+
2.3.6 Buffer and State Table
|
518
|
+
|
519
|
+
SMTP sessions are stateful, with both parties carefully maintaining a
|
520
|
+
common view of the current state. In this document we model this
|
521
|
+
state by a virtual "buffer" and a "state table" on the server which
|
522
|
+
may be used by the client to, for example, "clear the buffer" or
|
523
|
+
"reset the state table," causing the information in the buffer to be
|
524
|
+
discarded and the state to be returned to some previous state.
|
525
|
+
|
526
|
+
2.3.7 Lines
|
527
|
+
|
528
|
+
SMTP commands and, unless altered by a service extension, message
|
529
|
+
data, are transmitted in "lines". Lines consist of zero or more data
|
530
|
+
characters terminated by the sequence ASCII character "CR" (hex value
|
531
|
+
0D) followed immediately by ASCII character "LF" (hex value 0A).
|
532
|
+
This termination sequence is denoted as <CRLF> in this document.
|
533
|
+
Conforming implementations MUST NOT recognize or generate any other
|
534
|
+
character or character sequence as a line terminator. Limits MAY be
|
535
|
+
imposed on line lengths by servers (see section 4.5.3).
|
536
|
+
|
537
|
+
In addition, the appearance of "bare" "CR" or "LF" characters in text
|
538
|
+
(i.e., either without the other) has a long history of causing
|
539
|
+
problems in mail implementations and applications that use the mail
|
540
|
+
system as a tool. SMTP client implementations MUST NOT transmit
|
541
|
+
these characters except when they are intended as line terminators
|
542
|
+
and then MUST, as indicated above, transmit them only as a <CRLF>
|
543
|
+
sequence.
|
544
|
+
|
545
|
+
2.3.8 Originator, Delivery, Relay, and Gateway Systems
|
546
|
+
|
547
|
+
This specification makes a distinction among four types of SMTP
|
548
|
+
systems, based on the role those systems play in transmitting
|
549
|
+
electronic mail. An "originating" system (sometimes called an SMTP
|
550
|
+
originator) introduces mail into the Internet or, more generally,
|
551
|
+
into a transport service environment. A "delivery" SMTP system is
|
552
|
+
one that receives mail from a transport service environment and
|
553
|
+
passes it to a mail user agent or deposits it in a message store
|
554
|
+
which a mail user agent is expected to subsequently access. A
|
555
|
+
"relay" SMTP system (usually referred to just as a "relay") receives
|
556
|
+
mail from an SMTP client and transmits it, without modification to
|
557
|
+
the message data other than adding trace information, to another SMTP
|
558
|
+
server for further relaying or for delivery.
|
559
|
+
|
560
|
+
A "gateway" SMTP system (usually referred to just as a "gateway")
|
561
|
+
receives mail from a client system in one transport environment and
|
562
|
+
transmits it to a server system in another transport environment.
|
563
|
+
Differences in protocols or message semantics between the transport
|
564
|
+
environments on either side of a gateway may require that the gateway
|
565
|
+
system perform transformations to the message that are not permitted
|
566
|
+
to SMTP relay systems. For the purposes of this specification,
|
567
|
+
firewalls that rewrite addresses should be considered as gateways,
|
568
|
+
even if SMTP is used on both sides of them (see [11]).
|
569
|
+
|
570
|
+
2.3.9 Message Content and Mail Data
|
571
|
+
|
572
|
+
The terms "message content" and "mail data" are used interchangeably
|
573
|
+
in this document to describe the material transmitted after the DATA
|
574
|
+
command is accepted and before the end of data indication is
|
575
|
+
transmitted. Message content includes message headers and the
|
576
|
+
possibly-structured message body. The MIME specification [12]
|
577
|
+
provides the standard mechanisms for structured message bodies.
|
578
|
+
|
579
|
+
2.3.10 Mailbox and Address
|
580
|
+
|
581
|
+
As used in this specification, an "address" is a character string
|
582
|
+
that identifies a user to whom mail will be sent or a location into
|
583
|
+
which mail will be deposited. The term "mailbox" refers to that
|
584
|
+
depository. The two terms are typically used interchangeably unless
|
585
|
+
the distinction between the location in which mail is placed (the
|
586
|
+
mailbox) and a reference to it (the address) is important. An
|
587
|
+
address normally consists of user and domain specifications. The
|
588
|
+
standard mailbox naming convention is defined to be "local-
|
589
|
+
part@domain": contemporary usage permits a much broader set of
|
590
|
+
applications than simple "user names". Consequently, and due to a
|
591
|
+
long history of problems when intermediate hosts have attempted to
|
592
|
+
optimize transport by modifying them, the local-part MUST be
|
593
|
+
interpreted and assigned semantics only by the host specified in the
|
594
|
+
domain part of the address.
|
595
|
+
|
596
|
+
2.3.11 Reply
|
597
|
+
|
598
|
+
An SMTP reply is an acknowledgment (positive or negative) sent from
|
599
|
+
receiver to sender via the transmission channel in response to a
|
600
|
+
command. The general form of a reply is a numeric completion code
|
601
|
+
(indicating failure or success) usually followed by a text string.
|
602
|
+
The codes are for use by programs and the text is usually intended
|
603
|
+
for human users. Recent work [34] has specified further structuring
|
604
|
+
of the reply strings, including the use of supplemental and more
|
605
|
+
specific completion codes.
|
606
|
+
|
607
|
+
2.4 General Syntax Principles and Transaction Model
|
608
|
+
|
609
|
+
SMTP commands and replies have a rigid syntax. All commands begin
|
610
|
+
with a command verb. All Replies begin with a three digit numeric
|
611
|
+
code. In some commands and replies, arguments MUST follow the verb
|
612
|
+
or reply code. Some commands do not accept arguments (after the
|
613
|
+
verb), and some reply codes are followed, sometimes optionally, by
|
614
|
+
free form text. In both cases, where text appears, it is separated
|
615
|
+
from the verb or reply code by a space character. Complete
|
616
|
+
definitions of commands and replies appear in section 4.
|
617
|
+
|
618
|
+
Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command
|
619
|
+
and extension name keywords) are not case sensitive, with the sole
|
620
|
+
exception in this specification of a mailbox local-part (SMTP
|
621
|
+
Extensions may explicitly specify case-sensitive elements). That is,
|
622
|
+
a command verb, an argument value other than a mailbox local-part,
|
623
|
+
and free form text MAY be encoded in upper case, lower case, or any
|
624
|
+
mixture of upper and lower case with no impact on its meaning. This
|
625
|
+
is NOT true of a mailbox local-part. The local-part of a mailbox
|
626
|
+
MUST BE treated as case sensitive. Therefore, SMTP implementations
|
627
|
+
MUST take care to preserve the case of mailbox local-parts. Mailbox
|
628
|
+
domains are not case sensitive. In particular, for some hosts the
|
629
|
+
user "smith" is different from the user "Smith". However, exploiting
|
630
|
+
the case sensitivity of mailbox local-parts impedes interoperability
|
631
|
+
and is discouraged.
|
632
|
+
|
633
|
+
A few SMTP servers, in violation of this specification (and RFC 821)
|
634
|
+
require that command verbs be encoded by clients in upper case.
|
635
|
+
Implementations MAY wish to employ this encoding to accommodate those
|
636
|
+
servers.
|
637
|
+
|
638
|
+
The argument field consists of a variable length character string
|
639
|
+
ending with the end of the line, i.e., with the character sequence
|
640
|
+
<CRLF>. The receiver will take no action until this sequence is
|
641
|
+
received.
|
642
|
+
|
643
|
+
The syntax for each command is shown with the discussion of that
|
644
|
+
command. Common elements and parameters are shown in section 4.1.2.
|
645
|
+
|
646
|
+
Commands and replies are composed of characters from the ASCII
|
647
|
+
character set [1]. When the transport service provides an 8-bit byte
|
648
|
+
(octet) transmission channel, each 7-bit character is transmitted
|
649
|
+
right justified in an octet with the high order bit cleared to zero.
|
650
|
+
More specifically, the unextended SMTP service provides seven bit
|
651
|
+
transport only. An originating SMTP client which has not
|
652
|
+
successfully negotiated an appropriate extension with a particular
|
653
|
+
server MUST NOT transmit messages with information in the high-order
|
654
|
+
bit of octets. If such messages are transmitted in violation of this
|
655
|
+
rule, receiving SMTP servers MAY clear the high-order bit or reject
|
656
|
+
the message as invalid. In general, a relay SMTP SHOULD assume that
|
657
|
+
the message content it has received is valid and, assuming that the
|
658
|
+
envelope permits doing so, relay it without inspecting that content.
|
659
|
+
Of course, if the content is mislabeled and the data path cannot
|
660
|
+
accept the actual content, this may result in ultimate delivery of a
|
661
|
+
severely garbled message to the recipient. Delivery SMTP systems MAY
|
662
|
+
reject ("bounce") such messages rather than deliver them. No sending
|
663
|
+
SMTP system is permitted to send envelope commands in any character
|
664
|
+
|
665
|
+
set other than US-ASCII; receiving systems SHOULD reject such
|
666
|
+
commands, normally using "500 syntax error - invalid character"
|
667
|
+
replies.
|
668
|
+
|
669
|
+
Eight-bit message content transmission MAY be requested of the server
|
670
|
+
by a client using extended SMTP facilities, notably the "8BITMIME"
|
671
|
+
extension [20]. 8BITMIME SHOULD be supported by SMTP servers.
|
672
|
+
However, it MUST not be construed as authorization to transmit
|
673
|
+
unrestricted eight bit material. 8BITMIME MUST NOT be requested by
|
674
|
+
senders for material with the high bit on that is not in MIME format
|
675
|
+
with an appropriate content-transfer encoding; servers MAY reject
|
676
|
+
such messages.
|
677
|
+
|
678
|
+
The metalinguistic notation used in this document corresponds to the
|
679
|
+
"Augmented BNF" used in other Internet mail system documents. The
|
680
|
+
reader who is not familiar with that syntax should consult the ABNF
|
681
|
+
specification [8]. Metalanguage terms used in running text are
|
682
|
+
surrounded by pointed brackets (e.g., <CRLF>) for clarity.
|
683
|
+
|
684
|
+
3. The SMTP Procedures: An Overview
|
685
|
+
|
686
|
+
This section contains descriptions of the procedures used in SMTP:
|
687
|
+
session initiation, the mail transaction, forwarding mail, verifying
|
688
|
+
mailbox names and expanding mailing lists, and the opening and
|
689
|
+
closing exchanges. Comments on relaying, a note on mail domains, and
|
690
|
+
a discussion of changing roles are included at the end of this
|
691
|
+
section. Several complete scenarios are presented in appendix D.
|
692
|
+
|
693
|
+
3.1 Session Initiation
|
694
|
+
|
695
|
+
An SMTP session is initiated when a client opens a connection to a
|
696
|
+
server and the server responds with an opening message.
|
697
|
+
|
698
|
+
SMTP server implementations MAY include identification of their
|
699
|
+
software and version information in the connection greeting reply
|
700
|
+
after the 220 code, a practice that permits more efficient isolation
|
701
|
+
and repair of any problems. Implementations MAY make provision for
|
702
|
+
SMTP servers to disable the software and version announcement where
|
703
|
+
it causes security concerns. While some systems also identify their
|
704
|
+
contact point for mail problems, this is not a substitute for
|
705
|
+
maintaining the required "postmaster" address (see section 4.5.1).
|
706
|
+
|
707
|
+
The SMTP protocol allows a server to formally reject a transaction
|
708
|
+
while still allowing the initial connection as follows: a 554
|
709
|
+
response MAY be given in the initial connection opening message
|
710
|
+
instead of the 220. A server taking this approach MUST still wait
|
711
|
+
for the client to send a QUIT (see section 4.1.1.10) before closing
|
712
|
+
the connection and SHOULD respond to any intervening commands with
|
713
|
+
|
714
|
+
"503 bad sequence of commands". Since an attempt to make an SMTP
|
715
|
+
connection to such a system is probably in error, a server returning
|
716
|
+
a 554 response on connection opening SHOULD provide enough
|
717
|
+
information in the reply text to facilitate debugging of the sending
|
718
|
+
system.
|
719
|
+
|
720
|
+
3.2 Client Initiation
|
721
|
+
|
722
|
+
Once the server has sent the welcoming message and the client has
|
723
|
+
received it, the client normally sends the EHLO command to the
|
724
|
+
server, indicating the client's identity. In addition to opening the
|
725
|
+
session, use of EHLO indicates that the client is able to process
|
726
|
+
service extensions and requests that the server provide a list of the
|
727
|
+
extensions it supports. Older SMTP systems which are unable to
|
728
|
+
support service extensions and contemporary clients which do not
|
729
|
+
require service extensions in the mail session being initiated, MAY
|
730
|
+
use HELO instead of EHLO. Servers MUST NOT return the extended
|
731
|
+
EHLO-style response to a HELO command. For a particular connection
|
732
|
+
attempt, if the server returns a "command not recognized" response to
|
733
|
+
EHLO, the client SHOULD be able to fall back and send HELO.
|
734
|
+
|
735
|
+
In the EHLO command the host sending the command identifies itself;
|
736
|
+
the command may be interpreted as saying "Hello, I am <domain>" (and,
|
737
|
+
in the case of EHLO, "and I support service extension requests").
|
738
|
+
|
739
|
+
3.3 Mail Transactions
|
740
|
+
|
741
|
+
There are three steps to SMTP mail transactions. The transaction
|
742
|
+
starts with a MAIL command which gives the sender identification.
|
743
|
+
(In general, the MAIL command may be sent only when no mail
|
744
|
+
transaction is in progress; see section 4.1.4.) A series of one or
|
745
|
+
more RCPT commands follows giving the receiver information. Then a
|
746
|
+
DATA command initiates transfer of the mail data and is terminated by
|
747
|
+
the "end of mail" data indicator, which also confirms the
|
748
|
+
transaction.
|
749
|
+
|
750
|
+
The first step in the procedure is the MAIL command.
|
751
|
+
|
752
|
+
MAIL FROM:<reverse-path> [SP <mail-parameters> ] <CRLF>
|
753
|
+
|
754
|
+
This command tells the SMTP-receiver that a new mail transaction is
|
755
|
+
starting and to reset all its state tables and buffers, including any
|
756
|
+
recipients or mail data. The <reverse-path> portion of the first or
|
757
|
+
only argument contains the source mailbox (between "<" and ">"
|
758
|
+
brackets), which can be used to report errors (see section 4.2 for a
|
759
|
+
discussion of error reporting). If accepted, the SMTP server returns
|
760
|
+
a 250 OK reply. If the mailbox specification is not acceptable for
|
761
|
+
some reason, the server MUST return a reply indicating whether the
|
762
|
+
|
763
|
+
failure is permanent (i.e., will occur again if the client tries to
|
764
|
+
send the same address again) or temporary (i.e., the address might be
|
765
|
+
accepted if the client tries again later). Despite the apparent
|
766
|
+
scope of this requirement, there are circumstances in which the
|
767
|
+
acceptability of the reverse-path may not be determined until one or
|
768
|
+
more forward-paths (in RCPT commands) can be examined. In those
|
769
|
+
cases, the server MAY reasonably accept the reverse-path (with a 250
|
770
|
+
reply) and then report problems after the forward-paths are received
|
771
|
+
and examined. Normally, failures produce 550 or 553 replies.
|
772
|
+
|
773
|
+
Historically, the <reverse-path> can contain more than just a
|
774
|
+
mailbox, however, contemporary systems SHOULD NOT use source routing
|
775
|
+
(see appendix C).
|
776
|
+
|
777
|
+
The optional <mail-parameters> are associated with negotiated SMTP
|
778
|
+
service extensions (see section 2.2).
|
779
|
+
|
780
|
+
The second step in the procedure is the RCPT command.
|
781
|
+
|
782
|
+
RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
|
783
|
+
|
784
|
+
The first or only argument to this command includes a forward-path
|
785
|
+
(normally a mailbox and domain, always surrounded by "<" and ">"
|
786
|
+
brackets) identifying one recipient. If accepted, the SMTP server
|
787
|
+
returns a 250 OK reply and stores the forward-path. If the recipient
|
788
|
+
is known not to be a deliverable address, the SMTP server returns a
|
789
|
+
550 reply, typically with a string such as "no such user - " and the
|
790
|
+
mailbox name (other circumstances and reply codes are possible).
|
791
|
+
This step of the procedure can be repeated any number of times.
|
792
|
+
|
793
|
+
The <forward-path> can contain more than just a mailbox.
|
794
|
+
Historically, the <forward-path> can be a source routing list of
|
795
|
+
hosts and the destination mailbox, however, contemporary SMTP clients
|
796
|
+
SHOULD NOT utilize source routes (see appendix C). Servers MUST be
|
797
|
+
prepared to encounter a list of source routes in the forward path,
|
798
|
+
but SHOULD ignore the routes or MAY decline to support the relaying
|
799
|
+
they imply. Similarly, servers MAY decline to accept mail that is
|
800
|
+
destined for other hosts or systems. These restrictions make a
|
801
|
+
server useless as a relay for clients that do not support full SMTP
|
802
|
+
functionality. Consequently, restricted-capability clients MUST NOT
|
803
|
+
assume that any SMTP server on the Internet can be used as their mail
|
804
|
+
processing (relaying) site. If a RCPT command appears without a
|
805
|
+
previous MAIL command, the server MUST return a 503 "Bad sequence of
|
806
|
+
commands" response. The optional <rcpt-parameters> are associated
|
807
|
+
with negotiated SMTP service extensions (see section 2.2).
|
808
|
+
|
809
|
+
The third step in the procedure is the DATA command (or some
|
810
|
+
alternative specified in a service extension).
|
811
|
+
|
812
|
+
DATA <CRLF>
|
813
|
+
|
814
|
+
If accepted, the SMTP server returns a 354 Intermediate reply and
|
815
|
+
considers all succeeding lines up to but not including the end of
|
816
|
+
mail data indicator to be the message text. When the end of text is
|
817
|
+
successfully received and stored the SMTP-receiver sends a 250 OK
|
818
|
+
reply.
|
819
|
+
|
820
|
+
Since the mail data is sent on the transmission channel, the end of
|
821
|
+
mail data must be indicated so that the command and reply dialog can
|
822
|
+
be resumed. SMTP indicates the end of the mail data by sending a
|
823
|
+
line containing only a "." (period or full stop). A transparency
|
824
|
+
procedure is used to prevent this from interfering with the user's
|
825
|
+
text (see section 4.5.2).
|
826
|
+
|
827
|
+
The end of mail data indicator also confirms the mail transaction and
|
828
|
+
tells the SMTP server to now process the stored recipients and mail
|
829
|
+
data. If accepted, the SMTP server returns a 250 OK reply. The DATA
|
830
|
+
command can fail at only two points in the protocol exchange:
|
831
|
+
|
832
|
+
- If there was no MAIL, or no RCPT, command, or all such commands
|
833
|
+
were rejected, the server MAY return a "command out of sequence"
|
834
|
+
(503) or "no valid recipients" (554) reply in response to the DATA
|
835
|
+
command. If one of those replies (or any other 5yz reply) is
|
836
|
+
received, the client MUST NOT send the message data; more
|
837
|
+
generally, message data MUST NOT be sent unless a 354 reply is
|
838
|
+
received.
|
839
|
+
|
840
|
+
- If the verb is initially accepted and the 354 reply issued, the
|
841
|
+
DATA command should fail only if the mail transaction was
|
842
|
+
incomplete (for example, no recipients), or if resources were
|
843
|
+
unavailable (including, of course, the server unexpectedly
|
844
|
+
becoming unavailable), or if the server determines that the
|
845
|
+
message should be rejected for policy or other reasons.
|
846
|
+
|
847
|
+
However, in practice, some servers do not perform recipient
|
848
|
+
verification until after the message text is received. These servers
|
849
|
+
SHOULD treat a failure for one or more recipients as a "subsequent
|
850
|
+
failure" and return a mail message as discussed in section 6. Using
|
851
|
+
a "550 mailbox not found" (or equivalent) reply code after the data
|
852
|
+
are accepted makes it difficult or impossible for the client to
|
853
|
+
determine which recipients failed.
|
854
|
+
|
855
|
+
When RFC 822 format [7, 32] is being used, the mail data include the
|
856
|
+
memo header items such as Date, Subject, To, Cc, From. Server SMTP
|
857
|
+
systems SHOULD NOT reject messages based on perceived defects in the
|
858
|
+
RFC 822 or MIME [12] message header or message body. In particular,
|
859
|
+
|
860
|
+
they MUST NOT reject messages in which the numbers of Resent-fields
|
861
|
+
do not match or Resent-to appears without Resent-from and/or Resent-
|
862
|
+
date.
|
863
|
+
|
864
|
+
Mail transaction commands MUST be used in the order discussed above.
|
865
|
+
|
866
|
+
3.4 Forwarding for Address Correction or Updating
|
867
|
+
|
868
|
+
Forwarding support is most often required to consolidate and simplify
|
869
|
+
addresses within, or relative to, some enterprise and less frequently
|
870
|
+
to establish addresses to link a person's prior address with current
|
871
|
+
one. Silent forwarding of messages (without server notification to
|
872
|
+
the sender), for security or non-disclosure purposes, is common in
|
873
|
+
the contemporary Internet.
|
874
|
+
|
875
|
+
In both the enterprise and the "new address" cases, information
|
876
|
+
hiding (and sometimes security) considerations argue against exposure
|
877
|
+
of the "final" address through the SMTP protocol as a side-effect of
|
878
|
+
the forwarding activity. This may be especially important when the
|
879
|
+
final address may not even be reachable by the sender. Consequently,
|
880
|
+
the "forwarding" mechanisms described in section 3.2 of RFC 821, and
|
881
|
+
especially the 251 (corrected destination) and 551 reply codes from
|
882
|
+
RCPT must be evaluated carefully by implementers and, when they are
|
883
|
+
available, by those configuring systems.
|
884
|
+
|
885
|
+
In particular:
|
886
|
+
|
887
|
+
* Servers MAY forward messages when they are aware of an address
|
888
|
+
change. When they do so, they MAY either provide address-updating
|
889
|
+
information with a 251 code, or may forward "silently" and return
|
890
|
+
a 250 code. But, if a 251 code is used, they MUST NOT assume that
|
891
|
+
the client will actually update address information or even return
|
892
|
+
that information to the user.
|
893
|
+
|
894
|
+
Alternately,
|
895
|
+
|
896
|
+
* Servers MAY reject or bounce messages when they are not
|
897
|
+
deliverable when addressed. When they do so, they MAY either
|
898
|
+
provide address-updating information with a 551 code, or may
|
899
|
+
reject the message as undeliverable with a 550 code and no
|
900
|
+
address-specific information. But, if a 551 code is used, they
|
901
|
+
MUST NOT assume that the client will actually update address
|
902
|
+
information or even return that information to the user.
|
903
|
+
|
904
|
+
SMTP server implementations that support the 251 and/or 551 reply
|
905
|
+
codes are strongly encouraged to provide configuration mechanisms so
|
906
|
+
that sites which conclude that they would undesirably disclose
|
907
|
+
information can disable or restrict their use.
|
908
|
+
|
909
|
+
3.5 Commands for Debugging Addresses
|
910
|
+
|
911
|
+
3.5.1 Overview
|
912
|
+
|
913
|
+
SMTP provides commands to verify a user name or obtain the content of
|
914
|
+
a mailing list. This is done with the VRFY and EXPN commands, which
|
915
|
+
have character string arguments. Implementations SHOULD support VRFY
|
916
|
+
and EXPN (however, see section 3.5.2 and 7.3).
|
917
|
+
|
918
|
+
For the VRFY command, the string is a user name or a user name and
|
919
|
+
domain (see below). If a normal (i.e., 250) response is returned,
|
920
|
+
the response MAY include the full name of the user and MUST include
|
921
|
+
the mailbox of the user. It MUST be in either of the following
|
922
|
+
forms:
|
923
|
+
|
924
|
+
User Name <local-part@domain>
|
925
|
+
local-part@domain
|
926
|
+
|
927
|
+
When a name that is the argument to VRFY could identify more than one
|
928
|
+
mailbox, the server MAY either note the ambiguity or identify the
|
929
|
+
alternatives. In other words, any of the following are legitimate
|
930
|
+
response to VRFY:
|
931
|
+
|
932
|
+
553 User ambiguous
|
933
|
+
|
934
|
+
or
|
935
|
+
|
936
|
+
553- Ambiguous; Possibilities are
|
937
|
+
553-Joe Smith <jsmith@foo.com>
|
938
|
+
553-Harry Smith <hsmith@foo.com>
|
939
|
+
553 Melvin Smith <dweep@foo.com>
|
940
|
+
|
941
|
+
or
|
942
|
+
|
943
|
+
553-Ambiguous; Possibilities
|
944
|
+
553- <jsmith@foo.com>
|
945
|
+
553- <hsmith@foo.com>
|
946
|
+
553 <dweep@foo.com>
|
947
|
+
|
948
|
+
Under normal circumstances, a client receiving a 553 reply would be
|
949
|
+
expected to expose the result to the user. Use of exactly the forms
|
950
|
+
given, and the "user ambiguous" or "ambiguous" keywords, possibly
|
951
|
+
supplemented by extended reply codes such as those described in [34],
|
952
|
+
will facilitate automated translation into other languages as needed.
|
953
|
+
Of course, a client that was highly automated or that was operating
|
954
|
+
in another language than English, might choose to try to translate
|
955
|
+
the response, to return some other indication to the user than the
|
956
|
+
|
957
|
+
literal text of the reply, or to take some automated action such as
|
958
|
+
consulting a directory service for additional information before
|
959
|
+
reporting to the user.
|
960
|
+
|
961
|
+
For the EXPN command, the string identifies a mailing list, and the
|
962
|
+
successful (i.e., 250) multiline response MAY include the full name
|
963
|
+
of the users and MUST give the mailboxes on the mailing list.
|
964
|
+
|
965
|
+
In some hosts the distinction between a mailing list and an alias for
|
966
|
+
a single mailbox is a bit fuzzy, since a common data structure may
|
967
|
+
hold both types of entries, and it is possible to have mailing lists
|
968
|
+
containing only one mailbox. If a request is made to apply VRFY to a
|
969
|
+
mailing list, a positive response MAY be given if a message so
|
970
|
+
addressed would be delivered to everyone on the list, otherwise an
|
971
|
+
error SHOULD be reported (e.g., "550 That is a mailing list, not a
|
972
|
+
user" or "252 Unable to verify members of mailing list"). If a
|
973
|
+
request is made to expand a user name, the server MAY return a
|
974
|
+
positive response consisting of a list containing one name, or an
|
975
|
+
error MAY be reported (e.g., "550 That is a user name, not a mailing
|
976
|
+
list").
|
977
|
+
|
978
|
+
In the case of a successful multiline reply (normal for EXPN) exactly
|
979
|
+
one mailbox is to be specified on each line of the reply. The case
|
980
|
+
of an ambiguous request is discussed above.
|
981
|
+
|
982
|
+
"User name" is a fuzzy term and has been used deliberately. An
|
983
|
+
implementation of the VRFY or EXPN commands MUST include at least
|
984
|
+
recognition of local mailboxes as "user names". However, since
|
985
|
+
current Internet practice often results in a single host handling
|
986
|
+
mail for multiple domains, hosts, especially hosts that provide this
|
987
|
+
functionality, SHOULD accept the "local-part@domain" form as a "user
|
988
|
+
name"; hosts MAY also choose to recognize other strings as "user
|
989
|
+
names".
|
990
|
+
|
991
|
+
The case of expanding a mailbox list requires a multiline reply, such
|
992
|
+
as:
|
993
|
+
|
994
|
+
C: EXPN Example-People
|
995
|
+
S: 250-Jon Postel <Postel@isi.edu>
|
996
|
+
S: 250-Fred Fonebone <Fonebone@physics.foo-u.edu>
|
997
|
+
S: 250 Sam Q. Smith <SQSmith@specific.generic.com>
|
998
|
+
|
999
|
+
or
|
1000
|
+
|
1001
|
+
C: EXPN Executive-Washroom-List
|
1002
|
+
S: 550 Access Denied to You.
|
1003
|
+
|
1004
|
+
The character string arguments of the VRFY and EXPN commands cannot
|
1005
|
+
be further restricted due to the variety of implementations of the
|
1006
|
+
user name and mailbox list concepts. On some systems it may be
|
1007
|
+
appropriate for the argument of the EXPN command to be a file name
|
1008
|
+
for a file containing a mailing list, but again there are a variety
|
1009
|
+
of file naming conventions in the Internet. Similarly, historical
|
1010
|
+
variations in what is returned by these commands are such that the
|
1011
|
+
response SHOULD be interpreted very carefully, if at all, and SHOULD
|
1012
|
+
generally only be used for diagnostic purposes.
|
1013
|
+
|
1014
|
+
3.5.2 VRFY Normal Response
|
1015
|
+
|
1016
|
+
When normal (2yz or 551) responses are returned from a VRFY or EXPN
|
1017
|
+
request, the reply normally includes the mailbox name, i.e.,
|
1018
|
+
"<local-part@domain>", where "domain" is a fully qualified domain
|
1019
|
+
name, MUST appear in the syntax. In circumstances exceptional enough
|
1020
|
+
to justify violating the intent of this specification, free-form text
|
1021
|
+
MAY be returned. In order to facilitate parsing by both computers
|
1022
|
+
and people, addresses SHOULD appear in pointed brackets. When
|
1023
|
+
addresses, rather than free-form debugging information, are returned,
|
1024
|
+
EXPN and VRFY MUST return only valid domain addresses that are usable
|
1025
|
+
in SMTP RCPT commands. Consequently, if an address implies delivery
|
1026
|
+
to a program or other system, the mailbox name used to reach that
|
1027
|
+
target MUST be given. Paths (explicit source routes) MUST NOT be
|
1028
|
+
returned by VRFY or EXPN.
|
1029
|
+
|
1030
|
+
Server implementations SHOULD support both VRFY and EXPN. For
|
1031
|
+
security reasons, implementations MAY provide local installations a
|
1032
|
+
way to disable either or both of these commands through configuration
|
1033
|
+
options or the equivalent. When these commands are supported, they
|
1034
|
+
are not required to work across relays when relaying is supported.
|
1035
|
+
Since they were both optional in RFC 821, they MUST be listed as
|
1036
|
+
service extensions in an EHLO response, if they are supported.
|
1037
|
+
|
1038
|
+
3.5.3 Meaning of VRFY or EXPN Success Response
|
1039
|
+
|
1040
|
+
A server MUST NOT return a 250 code in response to a VRFY or EXPN
|
1041
|
+
command unless it has actually verified the address. In particular,
|
1042
|
+
a server MUST NOT return 250 if all it has done is to verify that the
|
1043
|
+
syntax given is valid. In that case, 502 (Command not implemented)
|
1044
|
+
or 500 (Syntax error, command unrecognized) SHOULD be returned. As
|
1045
|
+
stated elsewhere, implementation (in the sense of actually validating
|
1046
|
+
addresses and returning information) of VRFY and EXPN are strongly
|
1047
|
+
recommended. Hence, implementations that return 500 or 502 for VRFY
|
1048
|
+
are not in full compliance with this specification.
|
1049
|
+
|
1050
|
+
There may be circumstances where an address appears to be valid but
|
1051
|
+
cannot reasonably be verified in real time, particularly when a
|
1052
|
+
server is acting as a mail exchanger for another server or domain.
|
1053
|
+
"Apparent validity" in this case would normally involve at least
|
1054
|
+
syntax checking and might involve verification that any domains
|
1055
|
+
specified were ones to which the host expected to be able to relay
|
1056
|
+
mail. In these situations, reply code 252 SHOULD be returned. These
|
1057
|
+
cases parallel the discussion of RCPT verification discussed in
|
1058
|
+
section 2.1. Similarly, the discussion in section 3.4 applies to the
|
1059
|
+
use of reply codes 251 and 551 with VRFY (and EXPN) to indicate
|
1060
|
+
addresses that are recognized but that would be forwarded or bounced
|
1061
|
+
were mail received for them. Implementations generally SHOULD be
|
1062
|
+
more aggressive about address verification in the case of VRFY than
|
1063
|
+
in the case of RCPT, even if it takes a little longer to do so.
|
1064
|
+
|
1065
|
+
3.5.4 Semantics and Applications of EXPN
|
1066
|
+
|
1067
|
+
EXPN is often very useful in debugging and understanding problems
|
1068
|
+
with mailing lists and multiple-target-address aliases. Some systems
|
1069
|
+
have attempted to use source expansion of mailing lists as a means of
|
1070
|
+
eliminating duplicates. The propagation of aliasing systems with
|
1071
|
+
mail on the Internet, for hosts (typically with MX and CNAME DNS
|
1072
|
+
records), for mailboxes (various types of local host aliases), and in
|
1073
|
+
various proxying arrangements, has made it nearly impossible for
|
1074
|
+
these strategies to work consistently, and mail systems SHOULD NOT
|
1075
|
+
attempt them.
|
1076
|
+
|
1077
|
+
3.6 Domains
|
1078
|
+
|
1079
|
+
Only resolvable, fully-qualified, domain names (FQDNs) are permitted
|
1080
|
+
when domain names are used in SMTP. In other words, names that can
|
1081
|
+
be resolved to MX RRs or A RRs (as discussed in section 5) are
|
1082
|
+
permitted, as are CNAME RRs whose targets can be resolved, in turn,
|
1083
|
+
to MX or A RRs. Local nicknames or unqualified names MUST NOT be
|
1084
|
+
used. There are two exceptions to the rule requiring FQDNs:
|
1085
|
+
|
1086
|
+
- The domain name given in the EHLO command MUST BE either a primary
|
1087
|
+
host name (a domain name that resolves to an A RR) or, if the host
|
1088
|
+
has no name, an address literal as described in section 4.1.1.1.
|
1089
|
+
|
1090
|
+
- The reserved mailbox name "postmaster" may be used in a RCPT
|
1091
|
+
command without domain qualification (see section 4.1.1.3) and
|
1092
|
+
MUST be accepted if so used.
|
1093
|
+
|
1094
|
+
3.7 Relaying
|
1095
|
+
|
1096
|
+
In general, the availability of Mail eXchanger records in the domain
|
1097
|
+
name system [22, 27] makes the use of explicit source routes in the
|
1098
|
+
Internet mail system unnecessary. Many historical problems with
|
1099
|
+
their interpretation have made their use undesirable. SMTP clients
|
1100
|
+
SHOULD NOT generate explicit source routes except under unusual
|
1101
|
+
circumstances. SMTP servers MAY decline to act as mail relays or to
|
1102
|
+
accept addresses that specify source routes. When route information
|
1103
|
+
is encountered, SMTP servers are also permitted to ignore the route
|
1104
|
+
information and simply send to the final destination specified as the
|
1105
|
+
last element in the route and SHOULD do so. There has been an
|
1106
|
+
invalid practice of using names that do not appear in the DNS as
|
1107
|
+
destination names, with the senders counting on the intermediate
|
1108
|
+
hosts specified in source routing to resolve any problems. If source
|
1109
|
+
routes are stripped, this practice will cause failures. This is one
|
1110
|
+
of several reasons why SMTP clients MUST NOT generate invalid source
|
1111
|
+
routes or depend on serial resolution of names.
|
1112
|
+
|
1113
|
+
When source routes are not used, the process described in RFC 821 for
|
1114
|
+
constructing a reverse-path from the forward-path is not applicable
|
1115
|
+
and the reverse-path at the time of delivery will simply be the
|
1116
|
+
address that appeared in the MAIL command.
|
1117
|
+
|
1118
|
+
A relay SMTP server is usually the target of a DNS MX record that
|
1119
|
+
designates it, rather than the final delivery system. The relay
|
1120
|
+
server may accept or reject the task of relaying the mail in the same
|
1121
|
+
way it accepts or rejects mail for a local user. If it accepts the
|
1122
|
+
task, it then becomes an SMTP client, establishes a transmission
|
1123
|
+
channel to the next SMTP server specified in the DNS (according to
|
1124
|
+
the rules in section 5), and sends it the mail. If it declines to
|
1125
|
+
relay mail to a particular address for policy reasons, a 550 response
|
1126
|
+
SHOULD be returned.
|
1127
|
+
|
1128
|
+
Many mail-sending clients exist, especially in conjunction with
|
1129
|
+
facilities that receive mail via POP3 or IMAP, that have limited
|
1130
|
+
capability to support some of the requirements of this specification,
|
1131
|
+
such as the ability to queue messages for subsequent delivery
|
1132
|
+
attempts. For these clients, it is common practice to make private
|
1133
|
+
arrangements to send all messages to a single server for processing
|
1134
|
+
and subsequent distribution. SMTP, as specified here, is not ideally
|
1135
|
+
suited for this role, and work is underway on standardized mail
|
1136
|
+
submission protocols that might eventually supercede the current
|
1137
|
+
practices. In any event, because these arrangements are private and
|
1138
|
+
fall outside the scope of this specification, they are not described
|
1139
|
+
here.
|
1140
|
+
|
1141
|
+
It is important to note that MX records can point to SMTP servers
|
1142
|
+
which act as gateways into other environments, not just SMTP relays
|
1143
|
+
and final delivery systems; see sections 3.8 and 5.
|
1144
|
+
|
1145
|
+
If an SMTP server has accepted the task of relaying the mail and
|
1146
|
+
later finds that the destination is incorrect or that the mail cannot
|
1147
|
+
be delivered for some other reason, then it MUST construct an
|
1148
|
+
"undeliverable mail" notification message and send it to the
|
1149
|
+
originator of the undeliverable mail (as indicated by the reverse-
|
1150
|
+
path). Formats specified for non-delivery reports by other standards
|
1151
|
+
(see, for example, [24, 25]) SHOULD be used if possible.
|
1152
|
+
|
1153
|
+
This notification message must be from the SMTP server at the relay
|
1154
|
+
host or the host that first determines that delivery cannot be
|
1155
|
+
accomplished. Of course, SMTP servers MUST NOT send notification
|
1156
|
+
messages about problems transporting notification messages. One way
|
1157
|
+
to prevent loops in error reporting is to specify a null reverse-path
|
1158
|
+
in the MAIL command of a notification message. When such a message
|
1159
|
+
is transmitted the reverse-path MUST be set to null (see section
|
1160
|
+
4.5.5 for additional discussion). A MAIL command with a null
|
1161
|
+
reverse-path appears as follows:
|
1162
|
+
|
1163
|
+
MAIL FROM:<>
|
1164
|
+
|
1165
|
+
As discussed in section 2.4.1, a relay SMTP has no need to inspect or
|
1166
|
+
act upon the headers or body of the message data and MUST NOT do so
|
1167
|
+
except to add its own "Received:" header (section 4.4) and,
|
1168
|
+
optionally, to attempt to detect looping in the mail system (see
|
1169
|
+
section 6.2).
|
1170
|
+
|
1171
|
+
3.8 Mail Gatewaying
|
1172
|
+
|
1173
|
+
While the relay function discussed above operates within the Internet
|
1174
|
+
SMTP transport service environment, MX records or various forms of
|
1175
|
+
explicit routing may require that an intermediate SMTP server perform
|
1176
|
+
a translation function between one transport service and another. As
|
1177
|
+
discussed in section 2.3.8, when such a system is at the boundary
|
1178
|
+
between two transport service environments, we refer to it as a
|
1179
|
+
"gateway" or "gateway SMTP".
|
1180
|
+
|
1181
|
+
Gatewaying mail between different mail environments, such as
|
1182
|
+
different mail formats and protocols, is complex and does not easily
|
1183
|
+
yield to standardization. However, some general requirements may be
|
1184
|
+
given for a gateway between the Internet and another mail
|
1185
|
+
environment.
|
1186
|
+
|
1187
|
+
3.8.1 Header Fields in Gatewaying
|
1188
|
+
|
1189
|
+
Header fields MAY be rewritten when necessary as messages are
|
1190
|
+
gatewayed across mail environment boundaries. This may involve
|
1191
|
+
inspecting the message body or interpreting the local-part of the
|
1192
|
+
destination address in spite of the prohibitions in section 2.4.1.
|
1193
|
+
|
1194
|
+
Other mail systems gatewayed to the Internet often use a subset of
|
1195
|
+
RFC 822 headers or provide similar functionality with a different
|
1196
|
+
syntax, but some of these mail systems do not have an equivalent to
|
1197
|
+
the SMTP envelope. Therefore, when a message leaves the Internet
|
1198
|
+
environment, it may be necessary to fold the SMTP envelope
|
1199
|
+
information into the message header. A possible solution would be to
|
1200
|
+
create new header fields to carry the envelope information (e.g.,
|
1201
|
+
"X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this would require
|
1202
|
+
changes in mail programs in foreign environments and might risk
|
1203
|
+
disclosure of private information (see section 7.2).
|
1204
|
+
|
1205
|
+
3.8.2 Received Lines in Gatewaying
|
1206
|
+
|
1207
|
+
When forwarding a message into or out of the Internet environment, a
|
1208
|
+
gateway MUST prepend a Received: line, but it MUST NOT alter in any
|
1209
|
+
way a Received: line that is already in the header.
|
1210
|
+
|
1211
|
+
"Received:" fields of messages originating from other environments
|
1212
|
+
may not conform exactly to this specification. However, the most
|
1213
|
+
important use of Received: lines is for debugging mail faults, and
|
1214
|
+
this debugging can be severely hampered by well-meaning gateways that
|
1215
|
+
try to "fix" a Received: line. As another consequence of trace
|
1216
|
+
fields arising in non-SMTP environments, receiving systems MUST NOT
|
1217
|
+
reject mail based on the format of a trace field and SHOULD be
|
1218
|
+
extremely robust in the light of unexpected information or formats in
|
1219
|
+
those fields.
|
1220
|
+
|
1221
|
+
The gateway SHOULD indicate the environment and protocol in the "via"
|
1222
|
+
clauses of Received field(s) that it supplies.
|
1223
|
+
|
1224
|
+
3.8.3 Addresses in Gatewaying
|
1225
|
+
|
1226
|
+
From the Internet side, the gateway SHOULD accept all valid address
|
1227
|
+
formats in SMTP commands and in RFC 822 headers, and all valid RFC
|
1228
|
+
822 messages. Addresses and headers generated by gateways MUST
|
1229
|
+
conform to applicable Internet standards (including this one and RFC
|
1230
|
+
822). Gateways are, of course, subject to the same rules for
|
1231
|
+
handling source routes as those described for other SMTP systems in
|
1232
|
+
section 3.3.
|
1233
|
+
|
1234
|
+
3.8.4 Other Header Fields in Gatewaying
|
1235
|
+
|
1236
|
+
The gateway MUST ensure that all header fields of a message that it
|
1237
|
+
forwards into the Internet mail environment meet the requirements for
|
1238
|
+
Internet mail. In particular, all addresses in "From:", "To:",
|
1239
|
+
"Cc:", etc., fields MUST be transformed (if necessary) to satisfy RFC
|
1240
|
+
822 syntax, MUST reference only fully-qualified domain names, and
|
1241
|
+
MUST be effective and useful for sending replies. The translation
|
1242
|
+
algorithm used to convert mail from the Internet protocols to another
|
1243
|
+
environment's protocol SHOULD ensure that error messages from the
|
1244
|
+
foreign mail environment are delivered to the return path from the
|
1245
|
+
SMTP envelope, not to the sender listed in the "From:" field (or
|
1246
|
+
other fields) of the RFC 822 message.
|
1247
|
+
|
1248
|
+
3.8.5 Envelopes in Gatewaying
|
1249
|
+
|
1250
|
+
Similarly, when forwarding a message from another environment into
|
1251
|
+
the Internet, the gateway SHOULD set the envelope return path in
|
1252
|
+
accordance with an error message return address, if supplied by the
|
1253
|
+
foreign environment. If the foreign environment has no equivalent
|
1254
|
+
concept, the gateway must select and use a best approximation, with
|
1255
|
+
the message originator's address as the default of last resort.
|
1256
|
+
|
1257
|
+
3.9 Terminating Sessions and Connections
|
1258
|
+
|
1259
|
+
An SMTP connection is terminated when the client sends a QUIT
|
1260
|
+
command. The server responds with a positive reply code, after which
|
1261
|
+
it closes the connection.
|
1262
|
+
|
1263
|
+
An SMTP server MUST NOT intentionally close the connection except:
|
1264
|
+
|
1265
|
+
- After receiving a QUIT command and responding with a 221 reply.
|
1266
|
+
|
1267
|
+
- After detecting the need to shut down the SMTP service and
|
1268
|
+
returning a 421 response code. This response code can be issued
|
1269
|
+
after the server receives any command or, if necessary,
|
1270
|
+
asynchronously from command receipt (on the assumption that the
|
1271
|
+
client will receive it after the next command is issued).
|
1272
|
+
|
1273
|
+
In particular, a server that closes connections in response to
|
1274
|
+
commands that are not understood is in violation of this
|
1275
|
+
specification. Servers are expected to be tolerant of unknown
|
1276
|
+
commands, issuing a 500 reply and awaiting further instructions from
|
1277
|
+
the client.
|
1278
|
+
|
1279
|
+
An SMTP server which is forcibly shut down via external means SHOULD
|
1280
|
+
attempt to send a line containing a 421 response code to the SMTP
|
1281
|
+
client before exiting. The SMTP client will normally read the 421
|
1282
|
+
response code after sending its next command.
|
1283
|
+
|
1284
|
+
SMTP clients that experience a connection close, reset, or other
|
1285
|
+
communications failure due to circumstances not under their control
|
1286
|
+
(in violation of the intent of this specification but sometimes
|
1287
|
+
unavoidable) SHOULD, to maintain the robustness of the mail system,
|
1288
|
+
treat the mail transaction as if a 451 response had been received and
|
1289
|
+
act accordingly.
|
1290
|
+
|
1291
|
+
3.10 Mailing Lists and Aliases
|
1292
|
+
|
1293
|
+
An SMTP-capable host SHOULD support both the alias and the list
|
1294
|
+
models of address expansion for multiple delivery. When a message is
|
1295
|
+
delivered or forwarded to each address of an expanded list form, the
|
1296
|
+
return address in the envelope ("MAIL FROM:") MUST be changed to be
|
1297
|
+
the address of a person or other entity who administers the list.
|
1298
|
+
However, in this case, the message header [32] MUST be left
|
1299
|
+
unchanged; in particular, the "From" field of the message header is
|
1300
|
+
unaffected.
|
1301
|
+
|
1302
|
+
An important mail facility is a mechanism for multi-destination
|
1303
|
+
delivery of a single message, by transforming (or "expanding" or
|
1304
|
+
"exploding") a pseudo-mailbox address into a list of destination
|
1305
|
+
mailbox addresses. When a message is sent to such a pseudo-mailbox
|
1306
|
+
(sometimes called an "exploder"), copies are forwarded or
|
1307
|
+
redistributed to each mailbox in the expanded list. Servers SHOULD
|
1308
|
+
simply utilize the addresses on the list; application of heuristics
|
1309
|
+
or other matching rules to eliminate some addresses, such as that of
|
1310
|
+
the originator, is strongly discouraged. We classify such a pseudo-
|
1311
|
+
mailbox as an "alias" or a "list", depending upon the expansion
|
1312
|
+
rules.
|
1313
|
+
|
1314
|
+
3.10.1 Alias
|
1315
|
+
|
1316
|
+
To expand an alias, the recipient mailer simply replaces the pseudo-
|
1317
|
+
mailbox address in the envelope with each of the expanded addresses
|
1318
|
+
in turn; the rest of the envelope and the message body are left
|
1319
|
+
unchanged. The message is then delivered or forwarded to each
|
1320
|
+
expanded address.
|
1321
|
+
|
1322
|
+
3.10.2 List
|
1323
|
+
|
1324
|
+
A mailing list may be said to operate by "redistribution" rather than
|
1325
|
+
by "forwarding". To expand a list, the recipient mailer replaces the
|
1326
|
+
pseudo-mailbox address in the envelope with all of the expanded
|
1327
|
+
|
1328
|
+
addresses. The return address in the envelope is changed so that all
|
1329
|
+
error messages generated by the final deliveries will be returned to
|
1330
|
+
a list administrator, not to the message originator, who generally
|
1331
|
+
has no control over the contents of the list and will typically find
|
1332
|
+
error messages annoying.
|
1333
|
+
|
1334
|
+
4. The SMTP Specifications
|
1335
|
+
|
1336
|
+
4.1 SMTP Commands
|
1337
|
+
|
1338
|
+
4.1.1 Command Semantics and Syntax
|
1339
|
+
|
1340
|
+
The SMTP commands define the mail transfer or the mail system
|
1341
|
+
function requested by the user. SMTP commands are character strings
|
1342
|
+
terminated by <CRLF>. The commands themselves are alphabetic
|
1343
|
+
characters terminated by <SP> if parameters follow and <CRLF>
|
1344
|
+
otherwise. (In the interest of improved interoperability, SMTP
|
1345
|
+
receivers are encouraged to tolerate trailing white space before the
|
1346
|
+
terminating <CRLF>.) The syntax of the local part of a mailbox must
|
1347
|
+
conform to receiver site conventions and the syntax specified in
|
1348
|
+
section 4.1.2. The SMTP commands are discussed below. The SMTP
|
1349
|
+
replies are discussed in section 4.2.
|
1350
|
+
|
1351
|
+
A mail transaction involves several data objects which are
|
1352
|
+
communicated as arguments to different commands. The reverse-path is
|
1353
|
+
the argument of the MAIL command, the forward-path is the argument of
|
1354
|
+
the RCPT command, and the mail data is the argument of the DATA
|
1355
|
+
command. These arguments or data objects must be transmitted and
|
1356
|
+
held pending the confirmation communicated by the end of mail data
|
1357
|
+
indication which finalizes the transaction. The model for this is
|
1358
|
+
that distinct buffers are provided to hold the types of data objects,
|
1359
|
+
that is, there is a reverse-path buffer, a forward-path buffer, and a
|
1360
|
+
mail data buffer. Specific commands cause information to be appended
|
1361
|
+
to a specific buffer, or cause one or more buffers to be cleared.
|
1362
|
+
|
1363
|
+
Several commands (RSET, DATA, QUIT) are specified as not permitting
|
1364
|
+
parameters. In the absence of specific extensions offered by the
|
1365
|
+
server and accepted by the client, clients MUST NOT send such
|
1366
|
+
parameters and servers SHOULD reject commands containing them as
|
1367
|
+
having invalid syntax.
|
1368
|
+
|
1369
|
+
4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO)
|
1370
|
+
|
1371
|
+
These commands are used to identify the SMTP client to the SMTP
|
1372
|
+
server. The argument field contains the fully-qualified domain name
|
1373
|
+
of the SMTP client if one is available. In situations in which the
|
1374
|
+
SMTP client system does not have a meaningful domain name (e.g., when
|
1375
|
+
its address is dynamically allocated and no reverse mapping record is
|
1376
|
+
|
1377
|
+
available), the client SHOULD send an address literal (see section
|
1378
|
+
4.1.3), optionally followed by information that will help to identify
|
1379
|
+
the client system. y The SMTP server identifies itself to the SMTP
|
1380
|
+
client in the connection greeting reply and in the response to this
|
1381
|
+
command.
|
1382
|
+
|
1383
|
+
A client SMTP SHOULD start an SMTP session by issuing the EHLO
|
1384
|
+
command. If the SMTP server supports the SMTP service extensions it
|
1385
|
+
will give a successful response, a failure response, or an error
|
1386
|
+
response. If the SMTP server, in violation of this specification,
|
1387
|
+
does not support any SMTP service extensions it will generate an
|
1388
|
+
error response. Older client SMTP systems MAY, as discussed above,
|
1389
|
+
use HELO (as specified in RFC 821) instead of EHLO, and servers MUST
|
1390
|
+
support the HELO command and reply properly to it. In any event, a
|
1391
|
+
client MUST issue HELO or EHLO before starting a mail transaction.
|
1392
|
+
|
1393
|
+
These commands, and a "250 OK" reply to one of them, confirm that
|
1394
|
+
both the SMTP client and the SMTP server are in the initial state,
|
1395
|
+
that is, there is no transaction in progress and all state tables and
|
1396
|
+
buffers are cleared.
|
1397
|
+
|
1398
|
+
Syntax:
|
1399
|
+
|
1400
|
+
ehlo = "EHLO" SP Domain CRLF
|
1401
|
+
helo = "HELO" SP Domain CRLF
|
1402
|
+
|
1403
|
+
Normally, the response to EHLO will be a multiline reply. Each line
|
1404
|
+
of the response contains a keyword and, optionally, one or more
|
1405
|
+
parameters. Following the normal syntax for multiline replies, these
|
1406
|
+
keyworks follow the code (250) and a hyphen for all but the last
|
1407
|
+
line, and the code and a space for the last line. The syntax for a
|
1408
|
+
positive response, using the ABNF notation and terminal symbols of
|
1409
|
+
[8], is:
|
1410
|
+
|
1411
|
+
ehlo-ok-rsp = ( "250" domain [ SP ehlo-greet ] CRLF )
|
1412
|
+
/ ( "250-" domain [ SP ehlo-greet ] CRLF
|
1413
|
+
*( "250-" ehlo-line CRLF )
|
1414
|
+
"250" SP ehlo-line CRLF )
|
1415
|
+
|
1416
|
+
ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127)
|
1417
|
+
; string of any characters other than CR or LF
|
1418
|
+
|
1419
|
+
ehlo-line = ehlo-keyword *( SP ehlo-param )
|
1420
|
+
|
1421
|
+
ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
|
1422
|
+
; additional syntax of ehlo-params depends on
|
1423
|
+
; ehlo-keyword
|
1424
|
+
|
1425
|
+
ehlo-param = 1*(%d33-127)
|
1426
|
+
; any CHAR excluding <SP> and all
|
1427
|
+
; control characters (US-ASCII 0-31 inclusive)
|
1428
|
+
|
1429
|
+
Although EHLO keywords may be specified in upper, lower, or mixed
|
1430
|
+
case, they MUST always be recognized and processed in a case-
|
1431
|
+
insensitive manner. This is simply an extension of practices
|
1432
|
+
specified in RFC 821 and section 2.4.1.
|
1433
|
+
|
1434
|
+
4.1.1.2 MAIL (MAIL)
|
1435
|
+
|
1436
|
+
This command is used to initiate a mail transaction in which the mail
|
1437
|
+
data is delivered to an SMTP server which may, in turn, deliver it to
|
1438
|
+
one or more mailboxes or pass it on to another system (possibly using
|
1439
|
+
SMTP). The argument field contains a reverse-path and may contain
|
1440
|
+
optional parameters. In general, the MAIL command may be sent only
|
1441
|
+
when no mail transaction is in progress, see section 4.1.4.
|
1442
|
+
|
1443
|
+
The reverse-path consists of the sender mailbox. Historically, that
|
1444
|
+
mailbox might optionally have been preceded by a list of hosts, but
|
1445
|
+
that behavior is now deprecated (see appendix C). In some types of
|
1446
|
+
reporting messages for which a reply is likely to cause a mail loop
|
1447
|
+
(for example, mail delivery and nondelivery notifications), the
|
1448
|
+
reverse-path may be null (see section 3.7).
|
1449
|
+
|
1450
|
+
This command clears the reverse-path buffer, the forward-path buffer,
|
1451
|
+
and the mail data buffer; and inserts the reverse-path information
|
1452
|
+
from this command into the reverse-path buffer.
|
1453
|
+
|
1454
|
+
If service extensions were negotiated, the MAIL command may also
|
1455
|
+
carry parameters associated with a particular service extension.
|
1456
|
+
|
1457
|
+
Syntax:
|
1458
|
+
|
1459
|
+
"MAIL FROM:" ("<>" / Reverse-Path)
|
1460
|
+
[SP Mail-parameters] CRLF
|
1461
|
+
|
1462
|
+
4.1.1.3 RECIPIENT (RCPT)
|
1463
|
+
|
1464
|
+
This command is used to identify an individual recipient of the mail
|
1465
|
+
data; multiple recipients are specified by multiple use of this
|
1466
|
+
command. The argument field contains a forward-path and may contain
|
1467
|
+
optional parameters.
|
1468
|
+
|
1469
|
+
The forward-path normally consists of the required destination
|
1470
|
+
mailbox. Sending systems SHOULD not generate the optional list of
|
1471
|
+
hosts known as a source route. Receiving systems MUST recognize
|
1472
|
+
|
1473
|
+
source route syntax but SHOULD strip off the source route
|
1474
|
+
specification and utilize the domain name associated with the mailbox
|
1475
|
+
as if the source route had not been provided.
|
1476
|
+
|
1477
|
+
Similarly, relay hosts SHOULD strip or ignore source routes, and
|
1478
|
+
names MUST NOT be copied into the reverse-path. When mail reaches
|
1479
|
+
its ultimate destination (the forward-path contains only a
|
1480
|
+
destination mailbox), the SMTP server inserts it into the destination
|
1481
|
+
mailbox in accordance with its host mail conventions.
|
1482
|
+
|
1483
|
+
For example, mail received at relay host xyz.com with envelope
|
1484
|
+
commands
|
1485
|
+
|
1486
|
+
MAIL FROM:<userx@y.foo.org>
|
1487
|
+
RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org>
|
1488
|
+
|
1489
|
+
will normally be sent directly on to host d.bar.org with envelope
|
1490
|
+
commands
|
1491
|
+
|
1492
|
+
MAIL FROM:<userx@y.foo.org>
|
1493
|
+
RCPT TO:<userc@d.bar.org>
|
1494
|
+
|
1495
|
+
As provided in appendix C, xyz.com MAY also choose to relay the
|
1496
|
+
message to hosta.int, using the envelope commands
|
1497
|
+
|
1498
|
+
MAIL FROM:<userx@y.foo.org>
|
1499
|
+
RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org>
|
1500
|
+
|
1501
|
+
or to jkl.org, using the envelope commands
|
1502
|
+
|
1503
|
+
MAIL FROM:<userx@y.foo.org>
|
1504
|
+
RCPT TO:<@jkl.org:userc@d.bar.org>
|
1505
|
+
|
1506
|
+
Of course, since hosts are not required to relay mail at all, xyz.com
|
1507
|
+
may also reject the message entirely when the RCPT command is
|
1508
|
+
received, using a 550 code (since this is a "policy reason").
|
1509
|
+
|
1510
|
+
If service extensions were negotiated, the RCPT command may also
|
1511
|
+
carry parameters associated with a particular service extension
|
1512
|
+
offered by the server. The client MUST NOT transmit parameters other
|
1513
|
+
than those associated with a service extension offered by the server
|
1514
|
+
in its EHLO response.
|
1515
|
+
|
1516
|
+
Syntax:
|
1517
|
+
"RCPT TO:" ("<Postmaster@" domain ">" / "<Postmaster>" / Forward-Path)
|
1518
|
+
[SP Rcpt-parameters] CRLF
|
1519
|
+
|
1520
|
+
4.1.1.4 DATA (DATA)
|
1521
|
+
|
1522
|
+
The receiver normally sends a 354 response to DATA, and then treats
|
1523
|
+
the lines (strings ending in <CRLF> sequences, as described in
|
1524
|
+
section 2.3.7) following the command as mail data from the sender.
|
1525
|
+
This command causes the mail data to be appended to the mail data
|
1526
|
+
buffer. The mail data may contain any of the 128 ASCII character
|
1527
|
+
codes, although experience has indicated that use of control
|
1528
|
+
characters other than SP, HT, CR, and LF may cause problems and
|
1529
|
+
SHOULD be avoided when possible.
|
1530
|
+
|
1531
|
+
The mail data is terminated by a line containing only a period, that
|
1532
|
+
is, the character sequence "<CRLF>.<CRLF>" (see section 4.5.2). This
|
1533
|
+
is the end of mail data indication. Note that the first <CRLF> of
|
1534
|
+
this terminating sequence is also the <CRLF> that ends the final line
|
1535
|
+
of the data (message text) or, if there was no data, ends the DATA
|
1536
|
+
command itself. An extra <CRLF> MUST NOT be added, as that would
|
1537
|
+
cause an empty line to be added to the message. The only exception
|
1538
|
+
to this rule would arise if the message body were passed to the
|
1539
|
+
originating SMTP-sender with a final "line" that did not end in
|
1540
|
+
<CRLF>; in that case, the originating SMTP system MUST either reject
|
1541
|
+
the message as invalid or add <CRLF> in order to have the receiving
|
1542
|
+
SMTP server recognize the "end of data" condition.
|
1543
|
+
|
1544
|
+
The custom of accepting lines ending only in <LF>, as a concession to
|
1545
|
+
non-conforming behavior on the part of some UNIX systems, has proven
|
1546
|
+
to cause more interoperability problems than it solves, and SMTP
|
1547
|
+
server systems MUST NOT do this, even in the name of improved
|
1548
|
+
robustness. In particular, the sequence "<LF>.<LF>" (bare line
|
1549
|
+
feeds, without carriage returns) MUST NOT be treated as equivalent to
|
1550
|
+
<CRLF>.<CRLF> as the end of mail data indication.
|
1551
|
+
|
1552
|
+
Receipt of the end of mail data indication requires the server to
|
1553
|
+
process the stored mail transaction information. This processing
|
1554
|
+
consumes the information in the reverse-path buffer, the forward-path
|
1555
|
+
buffer, and the mail data buffer, and on the completion of this
|
1556
|
+
command these buffers are cleared. If the processing is successful,
|
1557
|
+
the receiver MUST send an OK reply. If the processing fails the
|
1558
|
+
receiver MUST send a failure reply. The SMTP model does not allow
|
1559
|
+
for partial failures at this point: either the message is accepted by
|
1560
|
+
the server for delivery and a positive response is returned or it is
|
1561
|
+
not accepted and a failure reply is returned. In sending a positive
|
1562
|
+
completion reply to the end of data indication, the receiver takes
|
1563
|
+
full responsibility for the message (see section 6.1). Errors that
|
1564
|
+
are diagnosed subsequently MUST be reported in a mail message, as
|
1565
|
+
discussed in section 4.4.
|
1566
|
+
|
1567
|
+
When the SMTP server accepts a message either for relaying or for
|
1568
|
+
final delivery, it inserts a trace record (also referred to
|
1569
|
+
interchangeably as a "time stamp line" or "Received" line) at the top
|
1570
|
+
of the mail data. This trace record indicates the identity of the
|
1571
|
+
host that sent the message, the identity of the host that received
|
1572
|
+
the message (and is inserting this time stamp), and the date and time
|
1573
|
+
the message was received. Relayed messages will have multiple time
|
1574
|
+
stamp lines. Details for formation of these lines, including their
|
1575
|
+
syntax, is specified in section 4.4.
|
1576
|
+
|
1577
|
+
Additional discussion about the operation of the DATA command appears
|
1578
|
+
in section 3.3.
|
1579
|
+
|
1580
|
+
Syntax:
|
1581
|
+
"DATA" CRLF
|
1582
|
+
|
1583
|
+
4.1.1.5 RESET (RSET)
|
1584
|
+
|
1585
|
+
This command specifies that the current mail transaction will be
|
1586
|
+
aborted. Any stored sender, recipients, and mail data MUST be
|
1587
|
+
discarded, and all buffers and state tables cleared. The receiver
|
1588
|
+
MUST send a "250 OK" reply to a RSET command with no arguments. A
|
1589
|
+
reset command may be issued by the client at any time. It is
|
1590
|
+
effectively equivalent to a NOOP (i.e., if has no effect) if issued
|
1591
|
+
immediately after EHLO, before EHLO is issued in the session, after
|
1592
|
+
an end-of-data indicator has been sent and acknowledged, or
|
1593
|
+
immediately before a QUIT. An SMTP server MUST NOT close the
|
1594
|
+
connection as the result of receiving a RSET; that action is reserved
|
1595
|
+
for QUIT (see section 4.1.1.10).
|
1596
|
+
|
1597
|
+
Since EHLO implies some additional processing and response by the
|
1598
|
+
server, RSET will normally be more efficient than reissuing that
|
1599
|
+
command, even though the formal semantics are the same.
|
1600
|
+
|
1601
|
+
There are circumstances, contrary to the intent of this
|
1602
|
+
specification, in which an SMTP server may receive an indication that
|
1603
|
+
the underlying TCP connection has been closed or reset. To preserve
|
1604
|
+
the robustness of the mail system, SMTP servers SHOULD be prepared
|
1605
|
+
for this condition and SHOULD treat it as if a QUIT had been received
|
1606
|
+
before the connection disappeared.
|
1607
|
+
|
1608
|
+
Syntax:
|
1609
|
+
"RSET" CRLF
|
1610
|
+
|
1611
|
+
4.1.1.6 VERIFY (VRFY)
|
1612
|
+
|
1613
|
+
This command asks the receiver to confirm that the argument
|
1614
|
+
identifies a user or mailbox. If it is a user name, information is
|
1615
|
+
returned as specified in section 3.5.
|
1616
|
+
|
1617
|
+
This command has no effect on the reverse-path buffer, the forward-
|
1618
|
+
path buffer, or the mail data buffer.
|
1619
|
+
|
1620
|
+
Syntax:
|
1621
|
+
"VRFY" SP String CRLF
|
1622
|
+
|
1623
|
+
4.1.1.7 EXPAND (EXPN)
|
1624
|
+
|
1625
|
+
This command asks the receiver to confirm that the argument
|
1626
|
+
identifies a mailing list, and if so, to return the membership of
|
1627
|
+
that list. If the command is successful, a reply is returned
|
1628
|
+
containing information as described in section 3.5. This reply will
|
1629
|
+
have multiple lines except in the trivial case of a one-member list.
|
1630
|
+
|
1631
|
+
This command has no effect on the reverse-path buffer, the forward-
|
1632
|
+
path buffer, or the mail data buffer and may be issued at any time.
|
1633
|
+
|
1634
|
+
Syntax:
|
1635
|
+
"EXPN" SP String CRLF
|
1636
|
+
|
1637
|
+
4.1.1.8 HELP (HELP)
|
1638
|
+
|
1639
|
+
This command causes the server to send helpful information to the
|
1640
|
+
client. The command MAY take an argument (e.g., any command name)
|
1641
|
+
and return more specific information as a response.
|
1642
|
+
|
1643
|
+
This command has no effect on the reverse-path buffer, the forward-
|
1644
|
+
path buffer, or the mail data buffer and may be issued at any time.
|
1645
|
+
|
1646
|
+
SMTP servers SHOULD support HELP without arguments and MAY support it
|
1647
|
+
with arguments.
|
1648
|
+
|
1649
|
+
Syntax:
|
1650
|
+
"HELP" [ SP String ] CRLF
|
1651
|
+
|
1652
|
+
4.1.1.9 NOOP (NOOP)
|
1653
|
+
|
1654
|
+
This command does not affect any parameters or previously entered
|
1655
|
+
commands. It specifies no action other than that the receiver send
|
1656
|
+
an OK reply.
|
1657
|
+
|
1658
|
+
This command has no effect on the reverse-path buffer, the forward-
|
1659
|
+
path buffer, or the mail data buffer and may be issued at any time.
|
1660
|
+
If a parameter string is specified, servers SHOULD ignore it.
|
1661
|
+
|
1662
|
+
Syntax:
|
1663
|
+
"NOOP" [ SP String ] CRLF
|
1664
|
+
|
1665
|
+
4.1.1.10 QUIT (QUIT)
|
1666
|
+
|
1667
|
+
This command specifies that the receiver MUST send an OK reply, and
|
1668
|
+
then close the transmission channel.
|
1669
|
+
|
1670
|
+
The receiver MUST NOT intentionally close the transmission channel
|
1671
|
+
until it receives and replies to a QUIT command (even if there was an
|
1672
|
+
error). The sender MUST NOT intentionally close the transmission
|
1673
|
+
channel until it sends a QUIT command and SHOULD wait until it
|
1674
|
+
receives the reply (even if there was an error response to a previous
|
1675
|
+
command). If the connection is closed prematurely due to violations
|
1676
|
+
of the above or system or network failure, the server MUST cancel any
|
1677
|
+
pending transaction, but not undo any previously completed
|
1678
|
+
transaction, and generally MUST act as if the command or transaction
|
1679
|
+
in progress had received a temporary error (i.e., a 4yz response).
|
1680
|
+
|
1681
|
+
The QUIT command may be issued at any time.
|
1682
|
+
|
1683
|
+
Syntax:
|
1684
|
+
"QUIT" CRLF
|
1685
|
+
|
1686
|
+
4.1.2 Command Argument Syntax
|
1687
|
+
|
1688
|
+
The syntax of the argument fields of the above commands (using the
|
1689
|
+
syntax specified in [8] where applicable) is given below. Some of
|
1690
|
+
the productions given below are used only in conjunction with source
|
1691
|
+
routes as described in appendix C. Terminals not defined in this
|
1692
|
+
document, such as ALPHA, DIGIT, SP, CR, LF, CRLF, are as defined in
|
1693
|
+
the "core" syntax [8 (section 6)] or in the message format syntax
|
1694
|
+
[32].
|
1695
|
+
|
1696
|
+
Reverse-path = Path
|
1697
|
+
Forward-path = Path
|
1698
|
+
Path = "<" [ A-d-l ":" ] Mailbox ">"
|
1699
|
+
A-d-l = At-domain *( "," A-d-l )
|
1700
|
+
; Note that this form, the so-called "source route",
|
1701
|
+
; MUST BE accepted, SHOULD NOT be generated, and SHOULD be
|
1702
|
+
; ignored.
|
1703
|
+
At-domain = "@" domain
|
1704
|
+
Mail-parameters = esmtp-param *(SP esmtp-param)
|
1705
|
+
Rcpt-parameters = esmtp-param *(SP esmtp-param)
|
1706
|
+
|
1707
|
+
esmtp-param = esmtp-keyword ["=" esmtp-value]
|
1708
|
+
esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
|
1709
|
+
esmtp-value = 1*(%d33-60 / %d62-127)
|
1710
|
+
; any CHAR excluding "=", SP, and control characters
|
1711
|
+
Keyword = Ldh-str
|
1712
|
+
Argument = Atom
|
1713
|
+
Domain = (sub-domain 1*("." sub-domain)) / address-literal
|
1714
|
+
sub-domain = Let-dig [Ldh-str]
|
1715
|
+
|
1716
|
+
address-literal = "[" IPv4-address-literal /
|
1717
|
+
IPv6-address-literal /
|
1718
|
+
General-address-literal "]"
|
1719
|
+
; See section 4.1.3
|
1720
|
+
|
1721
|
+
Mailbox = Local-part "@" Domain
|
1722
|
+
|
1723
|
+
Local-part = Dot-string / Quoted-string
|
1724
|
+
; MAY be case-sensitive
|
1725
|
+
|
1726
|
+
Dot-string = Atom *("." Atom)
|
1727
|
+
|
1728
|
+
Atom = 1*atext
|
1729
|
+
|
1730
|
+
Quoted-string = DQUOTE *qcontent DQUOTE
|
1731
|
+
|
1732
|
+
String = Atom / Quoted-string
|
1733
|
+
|
1734
|
+
While the above definition for Local-part is relatively permissive,
|
1735
|
+
for maximum interoperability, a host that expects to receive mail
|
1736
|
+
SHOULD avoid defining mailboxes where the Local-part requires (or
|
1737
|
+
uses) the Quoted-string form or where the Local-part is case-
|
1738
|
+
sensitive. For any purposes that require generating or comparing
|
1739
|
+
Local-parts (e.g., to specific mailbox names), all quoted forms MUST
|
1740
|
+
be treated as equivalent and the sending system SHOULD transmit the
|
1741
|
+
form that uses the minimum quoting possible.
|
1742
|
+
|
1743
|
+
Systems MUST NOT define mailboxes in such a way as to require the use
|
1744
|
+
in SMTP of non-ASCII characters (octets with the high order bit set
|
1745
|
+
to one) or ASCII "control characters" (decimal value 0-31 and 127).
|
1746
|
+
These characters MUST NOT be used in MAIL or RCPT commands or other
|
1747
|
+
commands that require mailbox names.
|
1748
|
+
|
1749
|
+
Note that the backslash, "\", is a quote character, which is used to
|
1750
|
+
indicate that the next character is to be used literally (instead of
|
1751
|
+
its normal interpretation). For example, "Joe\,Smith" indicates a
|
1752
|
+
single nine character user field with the comma being the fourth
|
1753
|
+
character of the field.
|
1754
|
+
|
1755
|
+
To promote interoperability and consistent with long-standing
|
1756
|
+
guidance about conservative use of the DNS in naming and applications
|
1757
|
+
(e.g., see section 2.3.1 of the base DNS document, RFC1035 [22]),
|
1758
|
+
characters outside the set of alphas, digits, and hyphen MUST NOT
|
1759
|
+
appear in domain name labels for SMTP clients or servers. In
|
1760
|
+
particular, the underscore character is not permitted. SMTP servers
|
1761
|
+
that receive a command in which invalid character codes have been
|
1762
|
+
employed, and for which there are no other reasons for rejection,
|
1763
|
+
MUST reject that command with a 501 response.
|
1764
|
+
|
1765
|
+
4.1.3 Address Literals
|
1766
|
+
|
1767
|
+
Sometimes a host is not known to the domain name system and
|
1768
|
+
communication (and, in particular, communication to report and repair
|
1769
|
+
the error) is blocked. To bypass this barrier a special literal form
|
1770
|
+
of the address is allowed as an alternative to a domain name. For
|
1771
|
+
IPv4 addresses, this form uses four small decimal integers separated
|
1772
|
+
by dots and enclosed by brackets such as [123.255.37.2], which
|
1773
|
+
indicates an (IPv4) Internet Address in sequence-of-octets form. For
|
1774
|
+
IPv6 and other forms of addressing that might eventually be
|
1775
|
+
standardized, the form consists of a standardized "tag" that
|
1776
|
+
identifies the address syntax, a colon, and the address itself, in a
|
1777
|
+
format specified as part of the IPv6 standards [17].
|
1778
|
+
|
1779
|
+
Specifically:
|
1780
|
+
|
1781
|
+
IPv4-address-literal = Snum 3("." Snum)
|
1782
|
+
IPv6-address-literal = "IPv6:" IPv6-addr
|
1783
|
+
General-address-literal = Standardized-tag ":" 1*dcontent
|
1784
|
+
Standardized-tag = Ldh-str
|
1785
|
+
; MUST be specified in a standards-track RFC
|
1786
|
+
; and registered with IANA
|
1787
|
+
|
1788
|
+
Snum = 1*3DIGIT ; representing a decimal integer
|
1789
|
+
; value in the range 0 through 255
|
1790
|
+
Let-dig = ALPHA / DIGIT
|
1791
|
+
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig
|
1792
|
+
|
1793
|
+
IPv6-addr = IPv6-full / IPv6-comp / IPv6v4-full / IPv6v4-comp
|
1794
|
+
IPv6-hex = 1*4HEXDIG
|
1795
|
+
IPv6-full = IPv6-hex 7(":" IPv6-hex)
|
1796
|
+
IPv6-comp = [IPv6-hex *5(":" IPv6-hex)] "::" [IPv6-hex *5(":"
|
1797
|
+
IPv6-hex)]
|
1798
|
+
; The "::" represents at least 2 16-bit groups of zeros
|
1799
|
+
; No more than 6 groups in addition to the "::" may be
|
1800
|
+
; present
|
1801
|
+
IPv6v4-full = IPv6-hex 5(":" IPv6-hex) ":" IPv4-address-literal
|
1802
|
+
IPv6v4-comp = [IPv6-hex *3(":" IPv6-hex)] "::"
|
1803
|
+
|
1804
|
+
[IPv6-hex *3(":" IPv6-hex) ":"] IPv4-address-literal
|
1805
|
+
; The "::" represents at least 2 16-bit groups of zeros
|
1806
|
+
; No more than 4 groups in addition to the "::" and
|
1807
|
+
; IPv4-address-literal may be present
|
1808
|
+
|
1809
|
+
4.1.4 Order of Commands
|
1810
|
+
|
1811
|
+
There are restrictions on the order in which these commands may be
|
1812
|
+
used.
|
1813
|
+
|
1814
|
+
A session that will contain mail transactions MUST first be
|
1815
|
+
initialized by the use of the EHLO command. An SMTP server SHOULD
|
1816
|
+
accept commands for non-mail transactions (e.g., VRFY or EXPN)
|
1817
|
+
without this initialization.
|
1818
|
+
|
1819
|
+
An EHLO command MAY be issued by a client later in the session. If
|
1820
|
+
it is issued after the session begins, the SMTP server MUST clear all
|
1821
|
+
buffers and reset the state exactly as if a RSET command had been
|
1822
|
+
issued. In other words, the sequence of RSET followed immediately by
|
1823
|
+
EHLO is redundant, but not harmful other than in the performance cost
|
1824
|
+
of executing unnecessary commands.
|
1825
|
+
|
1826
|
+
If the EHLO command is not acceptable to the SMTP server, 501, 500,
|
1827
|
+
or 502 failure replies MUST be returned as appropriate. The SMTP
|
1828
|
+
server MUST stay in the same state after transmitting these replies
|
1829
|
+
that it was in before the EHLO was received.
|
1830
|
+
|
1831
|
+
The SMTP client MUST, if possible, ensure that the domain parameter
|
1832
|
+
to the EHLO command is a valid principal host name (not a CNAME or MX
|
1833
|
+
name) for its host. If this is not possible (e.g., when the client's
|
1834
|
+
address is dynamically assigned and the client does not have an
|
1835
|
+
obvious name), an address literal SHOULD be substituted for the
|
1836
|
+
domain name and supplemental information provided that will assist in
|
1837
|
+
identifying the client.
|
1838
|
+
|
1839
|
+
An SMTP server MAY verify that the domain name parameter in the EHLO
|
1840
|
+
command actually corresponds to the IP address of the client.
|
1841
|
+
However, the server MUST NOT refuse to accept a message for this
|
1842
|
+
reason if the verification fails: the information about verification
|
1843
|
+
failure is for logging and tracing only.
|
1844
|
+
|
1845
|
+
The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time
|
1846
|
+
during a session, or without previously initializing a session. SMTP
|
1847
|
+
servers SHOULD process these normally (that is, not return a 503
|
1848
|
+
code) even if no EHLO command has yet been received; clients SHOULD
|
1849
|
+
open a session with EHLO before sending these commands.
|
1850
|
+
|
1851
|
+
If these rules are followed, the example in RFC 821 that shows "550
|
1852
|
+
access denied to you" in response to an EXPN command is incorrect
|
1853
|
+
unless an EHLO command precedes the EXPN or the denial of access is
|
1854
|
+
based on the client's IP address or other authentication or
|
1855
|
+
authorization-determining mechanisms.
|
1856
|
+
|
1857
|
+
The MAIL command (or the obsolete SEND, SOML, or SAML commands)
|
1858
|
+
begins a mail transaction. Once started, a mail transaction consists
|
1859
|
+
of a transaction beginning command, one or more RCPT commands, and a
|
1860
|
+
DATA command, in that order. A mail transaction may be aborted by
|
1861
|
+
the RSET (or a new EHLO) command. There may be zero or more
|
1862
|
+
transactions in a session. MAIL (or SEND, SOML, or SAML) MUST NOT be
|
1863
|
+
sent if a mail transaction is already open, i.e., it should be sent
|
1864
|
+
only if no mail transaction had been started in the session, or it
|
1865
|
+
the previous one successfully concluded with a successful DATA
|
1866
|
+
command, or if the previous one was aborted with a RSET.
|
1867
|
+
|
1868
|
+
If the transaction beginning command argument is not acceptable, a
|
1869
|
+
501 failure reply MUST be returned and the SMTP server MUST stay in
|
1870
|
+
the same state. If the commands in a transaction are out of order to
|
1871
|
+
the degree that they cannot be processed by the server, a 503 failure
|
1872
|
+
reply MUST be returned and the SMTP server MUST stay in the same
|
1873
|
+
state.
|
1874
|
+
|
1875
|
+
The last command in a session MUST be the QUIT command. The QUIT
|
1876
|
+
command cannot be used at any other time in a session, but SHOULD be
|
1877
|
+
used by the client SMTP to request connection closure, even when no
|
1878
|
+
session opening command was sent and accepted.
|
1879
|
+
|
1880
|
+
4.1.5 Private-use Commands
|
1881
|
+
|
1882
|
+
As specified in section 2.2.2, commands starting in "X" may be used
|
1883
|
+
by bilateral agreement between the client (sending) and server
|
1884
|
+
(receiving) SMTP agents. An SMTP server that does not recognize such
|
1885
|
+
a command is expected to reply with "500 Command not recognized". An
|
1886
|
+
extended SMTP server MAY list the feature names associated with these
|
1887
|
+
private commands in the response to the EHLO command.
|
1888
|
+
|
1889
|
+
Commands sent or accepted by SMTP systems that do not start with "X"
|
1890
|
+
MUST conform to the requirements of section 2.2.2.
|
1891
|
+
|
1892
|
+
4.2 SMTP Replies
|
1893
|
+
|
1894
|
+
Replies to SMTP commands serve to ensure the synchronization of
|
1895
|
+
requests and actions in the process of mail transfer and to guarantee
|
1896
|
+
that the SMTP client always knows the state of the SMTP server.
|
1897
|
+
Every command MUST generate exactly one reply.
|
1898
|
+
|
1899
|
+
The details of the command-reply sequence are described in section
|
1900
|
+
4.3.
|
1901
|
+
|
1902
|
+
An SMTP reply consists of a three digit number (transmitted as three
|
1903
|
+
numeric characters) followed by some text unless specified otherwise
|
1904
|
+
in this document. The number is for use by automata to determine
|
1905
|
+
what state to enter next; the text is for the human user. The three
|
1906
|
+
digits contain enough encoded information that the SMTP client need
|
1907
|
+
not examine the text and may either discard it or pass it on to the
|
1908
|
+
user, as appropriate. Exceptions are as noted elsewhere in this
|
1909
|
+
document. In particular, the 220, 221, 251, 421, and 551 reply codes
|
1910
|
+
are associated with message text that must be parsed and interpreted
|
1911
|
+
by machines. In the general case, the text may be receiver dependent
|
1912
|
+
and context dependent, so there are likely to be varying texts for
|
1913
|
+
each reply code. A discussion of the theory of reply codes is given
|
1914
|
+
in section 4.2.1. Formally, a reply is defined to be the sequence: a
|
1915
|
+
three-digit code, <SP>, one line of text, and <CRLF>, or a multiline
|
1916
|
+
reply (as defined in section 4.2.1). Since, in violation of this
|
1917
|
+
specification, the text is sometimes not sent, clients which do not
|
1918
|
+
receive it SHOULD be prepared to process the code alone (with or
|
1919
|
+
without a trailing space character). Only the EHLO, EXPN, and HELP
|
1920
|
+
commands are expected to result in multiline replies in normal
|
1921
|
+
circumstances, however, multiline replies are allowed for any
|
1922
|
+
command.
|
1923
|
+
|
1924
|
+
In ABNF, server responses are:
|
1925
|
+
|
1926
|
+
Greeting = "220 " Domain [ SP text ] CRLF
|
1927
|
+
Reply-line = Reply-code [ SP text ] CRLF
|
1928
|
+
|
1929
|
+
where "Greeting" appears only in the 220 response that announces that
|
1930
|
+
the server is opening its part of the connection.
|
1931
|
+
|
1932
|
+
An SMTP server SHOULD send only the reply codes listed in this
|
1933
|
+
document. An SMTP server SHOULD use the text shown in the examples
|
1934
|
+
whenever appropriate.
|
1935
|
+
|
1936
|
+
An SMTP client MUST determine its actions only by the reply code, not
|
1937
|
+
by the text (except for the "change of address" 251 and 551 and, if
|
1938
|
+
necessary, 220, 221, and 421 replies); in the general case, any text,
|
1939
|
+
including no text at all (although senders SHOULD NOT send bare
|
1940
|
+
codes), MUST be acceptable. The space (blank) following the reply
|
1941
|
+
code is considered part of the text. Whenever possible, a receiver-
|
1942
|
+
SMTP SHOULD test the first digit (severity indication) of the reply
|
1943
|
+
code.
|
1944
|
+
|
1945
|
+
The list of codes that appears below MUST NOT be construed as
|
1946
|
+
permanent. While the addition of new codes should be a rare and
|
1947
|
+
significant activity, with supplemental information in the textual
|
1948
|
+
part of the response being preferred, new codes may be added as the
|
1949
|
+
result of new Standards or Standards-track specifications.
|
1950
|
+
Consequently, a sender-SMTP MUST be prepared to handle codes not
|
1951
|
+
specified in this document and MUST do so by interpreting the first
|
1952
|
+
digit only.
|
1953
|
+
|
1954
|
+
4.2.1 Reply Code Severities and Theory
|
1955
|
+
|
1956
|
+
The three digits of the reply each have a special significance. The
|
1957
|
+
first digit denotes whether the response is good, bad or incomplete.
|
1958
|
+
An unsophisticated SMTP client, or one that receives an unexpected
|
1959
|
+
code, will be able to determine its next action (proceed as planned,
|
1960
|
+
redo, retrench, etc.) by examining this first digit. An SMTP client
|
1961
|
+
that wants to know approximately what kind of error occurred (e.g.,
|
1962
|
+
mail system error, command syntax error) may examine the second
|
1963
|
+
digit. The third digit and any supplemental information that may be
|
1964
|
+
present is reserved for the finest gradation of information.
|
1965
|
+
|
1966
|
+
There are five values for the first digit of the reply code:
|
1967
|
+
|
1968
|
+
1yz Positive Preliminary reply
|
1969
|
+
The command has been accepted, but the requested action is being
|
1970
|
+
held in abeyance, pending confirmation of the information in this
|
1971
|
+
reply. The SMTP client should send another command specifying
|
1972
|
+
whether to continue or abort the action. Note: unextended SMTP
|
1973
|
+
does not have any commands that allow this type of reply, and so
|
1974
|
+
does not have continue or abort commands.
|
1975
|
+
|
1976
|
+
2yz Positive Completion reply
|
1977
|
+
The requested action has been successfully completed. A new
|
1978
|
+
request may be initiated.
|
1979
|
+
|
1980
|
+
3yz Positive Intermediate reply
|
1981
|
+
The command has been accepted, but the requested action is being
|
1982
|
+
held in abeyance, pending receipt of further information. The
|
1983
|
+
SMTP client should send another command specifying this
|
1984
|
+
information. This reply is used in command sequence groups (i.e.,
|
1985
|
+
in DATA).
|
1986
|
+
|
1987
|
+
4yz Transient Negative Completion reply
|
1988
|
+
The command was not accepted, and the requested action did not
|
1989
|
+
occur. However, the error condition is temporary and the action
|
1990
|
+
may be requested again. The sender should return to the beginning
|
1991
|
+
of the command sequence (if any). It is difficult to assign a
|
1992
|
+
meaning to "transient" when two different sites (receiver- and
|
1993
|
+
|
1994
|
+
sender-SMTP agents) must agree on the interpretation. Each reply
|
1995
|
+
in this category might have a different time value, but the SMTP
|
1996
|
+
client is encouraged to try again. A rule of thumb to determine
|
1997
|
+
whether a reply fits into the 4yz or the 5yz category (see below)
|
1998
|
+
is that replies are 4yz if they can be successful if repeated
|
1999
|
+
without any change in command form or in properties of the sender
|
2000
|
+
or receiver (that is, the command is repeated identically and the
|
2001
|
+
receiver does not put up a new implementation.)
|
2002
|
+
|
2003
|
+
5yz Permanent Negative Completion reply
|
2004
|
+
The command was not accepted and the requested action did not
|
2005
|
+
occur. The SMTP client is discouraged from repeating the exact
|
2006
|
+
request (in the same sequence). Even some "permanent" error
|
2007
|
+
conditions can be corrected, so the human user may want to direct
|
2008
|
+
the SMTP client to reinitiate the command sequence by direct
|
2009
|
+
action at some point in the future (e.g., after the spelling has
|
2010
|
+
been changed, or the user has altered the account status).
|
2011
|
+
|
2012
|
+
The second digit encodes responses in specific categories:
|
2013
|
+
|
2014
|
+
x0z Syntax: These replies refer to syntax errors, syntactically
|
2015
|
+
correct commands that do not fit any functional category, and
|
2016
|
+
unimplemented or superfluous commands.
|
2017
|
+
|
2018
|
+
x1z Information: These are replies to requests for information,
|
2019
|
+
such as status or help.
|
2020
|
+
|
2021
|
+
x2z Connections: These are replies referring to the transmission
|
2022
|
+
channel.
|
2023
|
+
|
2024
|
+
x3z Unspecified.
|
2025
|
+
|
2026
|
+
x4z Unspecified.
|
2027
|
+
|
2028
|
+
x5z Mail system: These replies indicate the status of the receiver
|
2029
|
+
mail system vis-a-vis the requested transfer or other mail system
|
2030
|
+
action.
|
2031
|
+
|
2032
|
+
The third digit gives a finer gradation of meaning in each category
|
2033
|
+
specified by the second digit. The list of replies illustrates this.
|
2034
|
+
Each reply text is recommended rather than mandatory, and may even
|
2035
|
+
change according to the command with which it is associated. On the
|
2036
|
+
other hand, the reply codes must strictly follow the specifications
|
2037
|
+
in this section. Receiver implementations should not invent new
|
2038
|
+
codes for slightly different situations from the ones described here,
|
2039
|
+
but rather adapt codes already defined.
|
2040
|
+
|
2041
|
+
For example, a command such as NOOP, whose successful execution does
|
2042
|
+
not offer the SMTP client any new information, will return a 250
|
2043
|
+
reply. The reply is 502 when the command requests an unimplemented
|
2044
|
+
non-site-specific action. A refinement of that is the 504 reply for
|
2045
|
+
a command that is implemented, but that requests an unimplemented
|
2046
|
+
parameter.
|
2047
|
+
|
2048
|
+
The reply text may be longer than a single line; in these cases the
|
2049
|
+
complete text must be marked so the SMTP client knows when it can
|
2050
|
+
stop reading the reply. This requires a special format to indicate a
|
2051
|
+
multiple line reply.
|
2052
|
+
|
2053
|
+
The format for multiline replies requires that every line, except the
|
2054
|
+
last, begin with the reply code, followed immediately by a hyphen,
|
2055
|
+
"-" (also known as minus), followed by text. The last line will
|
2056
|
+
begin with the reply code, followed immediately by <SP>, optionally
|
2057
|
+
some text, and <CRLF>. As noted above, servers SHOULD send the <SP>
|
2058
|
+
if subsequent text is not sent, but clients MUST be prepared for it
|
2059
|
+
to be omitted.
|
2060
|
+
|
2061
|
+
For example:
|
2062
|
+
|
2063
|
+
123-First line
|
2064
|
+
123-Second line
|
2065
|
+
123-234 text beginning with numbers
|
2066
|
+
123 The last line
|
2067
|
+
|
2068
|
+
In many cases the SMTP client then simply needs to search for a line
|
2069
|
+
beginning with the reply code followed by <SP> or <CRLF> and ignore
|
2070
|
+
all preceding lines. In a few cases, there is important data for the
|
2071
|
+
client in the reply "text". The client will be able to identify
|
2072
|
+
these cases from the current context.
|
2073
|
+
|
2074
|
+
4.2.2 Reply Codes by Function Groups
|
2075
|
+
|
2076
|
+
500 Syntax error, command unrecognized
|
2077
|
+
(This may include errors such as command line too long)
|
2078
|
+
501 Syntax error in parameters or arguments
|
2079
|
+
502 Command not implemented (see section 4.2.4)
|
2080
|
+
503 Bad sequence of commands
|
2081
|
+
504 Command parameter not implemented
|
2082
|
+
|
2083
|
+
211 System status, or system help reply
|
2084
|
+
214 Help message
|
2085
|
+
(Information on how to use the receiver or the meaning of a
|
2086
|
+
particular non-standard command; this reply is useful only
|
2087
|
+
to the human user)
|
2088
|
+
|
2089
|
+
220 <domain> Service ready
|
2090
|
+
221 <domain> Service closing transmission channel
|
2091
|
+
421 <domain> Service not available, closing transmission channel
|
2092
|
+
(This may be a reply to any command if the service knows it
|
2093
|
+
must shut down)
|
2094
|
+
|
2095
|
+
250 Requested mail action okay, completed
|
2096
|
+
251 User not local; will forward to <forward-path>
|
2097
|
+
(See section 3.4)
|
2098
|
+
252 Cannot VRFY user, but will accept message and attempt
|
2099
|
+
delivery
|
2100
|
+
(See section 3.5.3)
|
2101
|
+
450 Requested mail action not taken: mailbox unavailable
|
2102
|
+
(e.g., mailbox busy)
|
2103
|
+
550 Requested action not taken: mailbox unavailable
|
2104
|
+
(e.g., mailbox not found, no access, or command rejected
|
2105
|
+
for policy reasons)
|
2106
|
+
451 Requested action aborted: error in processing
|
2107
|
+
551 User not local; please try <forward-path>
|
2108
|
+
(See section 3.4)
|
2109
|
+
452 Requested action not taken: insufficient system storage
|
2110
|
+
552 Requested mail action aborted: exceeded storage allocation
|
2111
|
+
553 Requested action not taken: mailbox name not allowed
|
2112
|
+
(e.g., mailbox syntax incorrect)
|
2113
|
+
354 Start mail input; end with <CRLF>.<CRLF>
|
2114
|
+
554 Transaction failed (Or, in the case of a connection-opening
|
2115
|
+
response, "No SMTP service here")
|
2116
|
+
|
2117
|
+
4.2.3 Reply Codes in Numeric Order
|
2118
|
+
|
2119
|
+
211 System status, or system help reply
|
2120
|
+
214 Help message
|
2121
|
+
(Information on how to use the receiver or the meaning of a
|
2122
|
+
particular non-standard command; this reply is useful only
|
2123
|
+
to the human user)
|
2124
|
+
220 <domain> Service ready
|
2125
|
+
221 <domain> Service closing transmission channel
|
2126
|
+
250 Requested mail action okay, completed
|
2127
|
+
251 User not local; will forward to <forward-path>
|
2128
|
+
(See section 3.4)
|
2129
|
+
252 Cannot VRFY user, but will accept message and attempt
|
2130
|
+
delivery
|
2131
|
+
(See section 3.5.3)
|
2132
|
+
|
2133
|
+
354 Start mail input; end with <CRLF>.<CRLF>
|
2134
|
+
|
2135
|
+
421 <domain> Service not available, closing transmission channel
|
2136
|
+
(This may be a reply to any command if the service knows it
|
2137
|
+
must shut down)
|
2138
|
+
450 Requested mail action not taken: mailbox unavailable
|
2139
|
+
(e.g., mailbox busy)
|
2140
|
+
451 Requested action aborted: local error in processing
|
2141
|
+
452 Requested action not taken: insufficient system storage
|
2142
|
+
500 Syntax error, command unrecognized
|
2143
|
+
(This may include errors such as command line too long)
|
2144
|
+
501 Syntax error in parameters or arguments
|
2145
|
+
502 Command not implemented (see section 4.2.4)
|
2146
|
+
503 Bad sequence of commands
|
2147
|
+
504 Command parameter not implemented
|
2148
|
+
550 Requested action not taken: mailbox unavailable
|
2149
|
+
(e.g., mailbox not found, no access, or command rejected
|
2150
|
+
for policy reasons)
|
2151
|
+
551 User not local; please try <forward-path>
|
2152
|
+
(See section 3.4)
|
2153
|
+
552 Requested mail action aborted: exceeded storage allocation
|
2154
|
+
553 Requested action not taken: mailbox name not allowed
|
2155
|
+
(e.g., mailbox syntax incorrect)
|
2156
|
+
554 Transaction failed (Or, in the case of a connection-opening
|
2157
|
+
response, "No SMTP service here")
|
2158
|
+
|
2159
|
+
4.2.4 Reply Code 502
|
2160
|
+
|
2161
|
+
Questions have been raised as to when reply code 502 (Command not
|
2162
|
+
implemented) SHOULD be returned in preference to other codes. 502
|
2163
|
+
SHOULD be used when the command is actually recognized by the SMTP
|
2164
|
+
server, but not implemented. If the command is not recognized, code
|
2165
|
+
500 SHOULD be returned. Extended SMTP systems MUST NOT list
|
2166
|
+
capabilities in response to EHLO for which they will return 502 (or
|
2167
|
+
500) replies.
|
2168
|
+
|
2169
|
+
4.2.5 Reply Codes After DATA and the Subsequent <CRLF>.<CRLF>
|
2170
|
+
|
2171
|
+
When an SMTP server returns a positive completion status (2yz code)
|
2172
|
+
after the DATA command is completed with <CRLF>.<CRLF>, it accepts
|
2173
|
+
responsibility for:
|
2174
|
+
|
2175
|
+
- delivering the message (if the recipient mailbox exists), or
|
2176
|
+
|
2177
|
+
- if attempts to deliver the message fail due to transient
|
2178
|
+
conditions, retrying delivery some reasonable number of times at
|
2179
|
+
intervals as specified in section 4.5.4.
|
2180
|
+
|
2181
|
+
- if attempts to deliver the message fail due to permanent
|
2182
|
+
conditions, or if repeated attempts to deliver the message fail
|
2183
|
+
due to transient conditions, returning appropriate notification to
|
2184
|
+
the sender of the original message (using the address in the SMTP
|
2185
|
+
MAIL command).
|
2186
|
+
|
2187
|
+
When an SMTP server returns a permanent error status (5yz) code after
|
2188
|
+
the DATA command is completed with <CRLF>.<CRLF>, it MUST NOT make
|
2189
|
+
any subsequent attempt to deliver that message. The SMTP client
|
2190
|
+
retains responsibility for delivery of that message and may either
|
2191
|
+
return it to the user or requeue it for a subsequent attempt (see
|
2192
|
+
section 4.5.4.1).
|
2193
|
+
|
2194
|
+
The user who originated the message SHOULD be able to interpret the
|
2195
|
+
return of a transient failure status (by mail message or otherwise)
|
2196
|
+
as a non-delivery indication, just as a permanent failure would be
|
2197
|
+
interpreted. I.e., if the client SMTP successfully handles these
|
2198
|
+
conditions, the user will not receive such a reply.
|
2199
|
+
|
2200
|
+
When an SMTP server returns a permanent error status (5yz) code after
|
2201
|
+
the DATA command is completely with <CRLF>.<CRLF>, it MUST NOT make
|
2202
|
+
any subsequent attempt to deliver the message. As with temporary
|
2203
|
+
error status codes, the SMTP client retains responsibility for the
|
2204
|
+
message, but SHOULD not again attempt delivery to the same server
|
2205
|
+
without user review and intervention of the message.
|
2206
|
+
|
2207
|
+
4.3 Sequencing of Commands and Replies
|
2208
|
+
|
2209
|
+
4.3.1 Sequencing Overview
|
2210
|
+
|
2211
|
+
The communication between the sender and receiver is an alternating
|
2212
|
+
dialogue, controlled by the sender. As such, the sender issues a
|
2213
|
+
command and the receiver responds with a reply. Unless other
|
2214
|
+
arrangements are negotiated through service extensions, the sender
|
2215
|
+
MUST wait for this response before sending further commands.
|
2216
|
+
|
2217
|
+
One important reply is the connection greeting. Normally, a receiver
|
2218
|
+
will send a 220 "Service ready" reply when the connection is
|
2219
|
+
completed. The sender SHOULD wait for this greeting message before
|
2220
|
+
sending any commands.
|
2221
|
+
|
2222
|
+
Note: all the greeting-type replies have the official name (the
|
2223
|
+
fully-qualified primary domain name) of the server host as the first
|
2224
|
+
word following the reply code. Sometimes the host will have no
|
2225
|
+
meaningful name. See 4.1.3 for a discussion of alternatives in these
|
2226
|
+
situations.
|
2227
|
+
|
2228
|
+
For example,
|
2229
|
+
|
2230
|
+
220 ISIF.USC.EDU Service ready
|
2231
|
+
or
|
2232
|
+
220 mail.foo.com SuperSMTP v 6.1.2 Service ready
|
2233
|
+
or
|
2234
|
+
220 [10.0.0.1] Clueless host service ready
|
2235
|
+
|
2236
|
+
The table below lists alternative success and failure replies for
|
2237
|
+
each command. These SHOULD be strictly adhered to: a receiver may
|
2238
|
+
substitute text in the replies, but the meaning and action implied by
|
2239
|
+
the code numbers and by the specific command reply sequence cannot be
|
2240
|
+
altered.
|
2241
|
+
|
2242
|
+
4.3.2 Command-Reply Sequences
|
2243
|
+
|
2244
|
+
Each command is listed with its usual possible replies. The prefixes
|
2245
|
+
used before the possible replies are "I" for intermediate, "S" for
|
2246
|
+
success, and "E" for error. Since some servers may generate other
|
2247
|
+
replies under special circumstances, and to allow for future
|
2248
|
+
extension, SMTP clients SHOULD, when possible, interpret only the
|
2249
|
+
first digit of the reply and MUST be prepared to deal with
|
2250
|
+
unrecognized reply codes by interpreting the first digit only.
|
2251
|
+
Unless extended using the mechanisms described in section 2.2, SMTP
|
2252
|
+
servers MUST NOT transmit reply codes to an SMTP client that are
|
2253
|
+
other than three digits or that do not start in a digit between 2 and
|
2254
|
+
5 inclusive.
|
2255
|
+
|
2256
|
+
These sequencing rules and, in principle, the codes themselves, can
|
2257
|
+
be extended or modified by SMTP extensions offered by the server and
|
2258
|
+
accepted (requested) by the client.
|
2259
|
+
|
2260
|
+
In addition to the codes listed below, any SMTP command can return
|
2261
|
+
any of the following codes if the corresponding unusual circumstances
|
2262
|
+
are encountered:
|
2263
|
+
|
2264
|
+
500 For the "command line too long" case or if the command name was
|
2265
|
+
not recognized. Note that producing a "command not recognized"
|
2266
|
+
error in response to the required subset of these commands is a
|
2267
|
+
violation of this specification.
|
2268
|
+
|
2269
|
+
501 Syntax error in command or arguments. In order to provide for
|
2270
|
+
future extensions, commands that are specified in this document as
|
2271
|
+
not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501
|
2272
|
+
message if arguments are supplied in the absence of EHLO-
|
2273
|
+
advertised extensions.
|
2274
|
+
|
2275
|
+
421 Service shutting down and closing transmission channel
|
2276
|
+
|
2277
|
+
Specific sequences are:
|
2278
|
+
|
2279
|
+
CONNECTION ESTABLISHMENT
|
2280
|
+
S: 220
|
2281
|
+
E: 554
|
2282
|
+
EHLO or HELO
|
2283
|
+
S: 250
|
2284
|
+
E: 504, 550
|
2285
|
+
MAIL
|
2286
|
+
S: 250
|
2287
|
+
E: 552, 451, 452, 550, 553, 503
|
2288
|
+
RCPT
|
2289
|
+
S: 250, 251 (but see section 3.4 for discussion of 251 and 551)
|
2290
|
+
E: 550, 551, 552, 553, 450, 451, 452, 503, 550
|
2291
|
+
DATA
|
2292
|
+
I: 354 -> data -> S: 250
|
2293
|
+
E: 552, 554, 451, 452
|
2294
|
+
E: 451, 554, 503
|
2295
|
+
RSET
|
2296
|
+
S: 250
|
2297
|
+
VRFY
|
2298
|
+
S: 250, 251, 252
|
2299
|
+
E: 550, 551, 553, 502, 504
|
2300
|
+
EXPN
|
2301
|
+
S: 250, 252
|
2302
|
+
E: 550, 500, 502, 504
|
2303
|
+
HELP
|
2304
|
+
S: 211, 214
|
2305
|
+
E: 502, 504
|
2306
|
+
NOOP
|
2307
|
+
S: 250
|
2308
|
+
QUIT
|
2309
|
+
S: 221
|
2310
|
+
|
2311
|
+
4.4 Trace Information
|
2312
|
+
|
2313
|
+
When an SMTP server receives a message for delivery or further
|
2314
|
+
processing, it MUST insert trace ("time stamp" or "Received")
|
2315
|
+
information at the beginning of the message content, as discussed in
|
2316
|
+
section 4.1.1.4.
|
2317
|
+
|
2318
|
+
This line MUST be structured as follows:
|
2319
|
+
|
2320
|
+
- The FROM field, which MUST be supplied in an SMTP environment,
|
2321
|
+
SHOULD contain both (1) the name of the source host as presented
|
2322
|
+
in the EHLO command and (2) an address literal containing the IP
|
2323
|
+
address of the source, determined from the TCP connection.
|
2324
|
+
|
2325
|
+
- The ID field MAY contain an "@" as suggested in RFC 822, but this
|
2326
|
+
is not required.
|
2327
|
+
|
2328
|
+
- The FOR field MAY contain a list of <path> entries when multiple
|
2329
|
+
RCPT commands have been given. This may raise some security
|
2330
|
+
issues and is usually not desirable; see section 7.2.
|
2331
|
+
|
2332
|
+
An Internet mail program MUST NOT change a Received: line that was
|
2333
|
+
previously added to the message header. SMTP servers MUST prepend
|
2334
|
+
Received lines to messages; they MUST NOT change the order of
|
2335
|
+
existing lines or insert Received lines in any other location.
|
2336
|
+
|
2337
|
+
As the Internet grows, comparability of Received fields is important
|
2338
|
+
for detecting problems, especially slow relays. SMTP servers that
|
2339
|
+
create Received fields SHOULD use explicit offsets in the dates
|
2340
|
+
(e.g., -0800), rather than time zone names of any type. Local time
|
2341
|
+
(with an offset) is preferred to UT when feasible. This formulation
|
2342
|
+
allows slightly more information about local circumstances to be
|
2343
|
+
specified. If UT is needed, the receiver need merely do some simple
|
2344
|
+
arithmetic to convert the values. Use of UT loses information about
|
2345
|
+
the time zone-location of the server. If it is desired to supply a
|
2346
|
+
time zone name, it SHOULD be included in a comment.
|
2347
|
+
|
2348
|
+
When the delivery SMTP server makes the "final delivery" of a
|
2349
|
+
message, it inserts a return-path line at the beginning of the mail
|
2350
|
+
data. This use of return-path is required; mail systems MUST support
|
2351
|
+
it. The return-path line preserves the information in the <reverse-
|
2352
|
+
path> from the MAIL command. Here, final delivery means the message
|
2353
|
+
has left the SMTP environment. Normally, this would mean it had been
|
2354
|
+
delivered to the destination user or an associated mail drop, but in
|
2355
|
+
some cases it may be further processed and transmitted by another
|
2356
|
+
mail system.
|
2357
|
+
|
2358
|
+
It is possible for the mailbox in the return path to be different
|
2359
|
+
from the actual sender's mailbox, for example, if error responses are
|
2360
|
+
to be delivered to a special error handling mailbox rather than to
|
2361
|
+
the message sender. When mailing lists are involved, this
|
2362
|
+
arrangement is common and useful as a means of directing errors to
|
2363
|
+
the list maintainer rather than the message originator.
|
2364
|
+
|
2365
|
+
The text above implies that the final mail data will begin with a
|
2366
|
+
return path line, followed by one or more time stamp lines. These
|
2367
|
+
lines will be followed by the mail data headers and body [32].
|
2368
|
+
|
2369
|
+
It is sometimes difficult for an SMTP server to determine whether or
|
2370
|
+
not it is making final delivery since forwarding or other operations
|
2371
|
+
may occur after the message is accepted for delivery. Consequently,
|
2372
|
+
|
2373
|
+
any further (forwarding, gateway, or relay) systems MAY remove the
|
2374
|
+
return path and rebuild the MAIL command as needed to ensure that
|
2375
|
+
exactly one such line appears in a delivered message.
|
2376
|
+
|
2377
|
+
A message-originating SMTP system SHOULD NOT send a message that
|
2378
|
+
already contains a Return-path header. SMTP servers performing a
|
2379
|
+
relay function MUST NOT inspect the message data, and especially not
|
2380
|
+
to the extent needed to determine if Return-path headers are present.
|
2381
|
+
SMTP servers making final delivery MAY remove Return-path headers
|
2382
|
+
before adding their own.
|
2383
|
+
|
2384
|
+
The primary purpose of the Return-path is to designate the address to
|
2385
|
+
which messages indicating non-delivery or other mail system failures
|
2386
|
+
are to be sent. For this to be unambiguous, exactly one return path
|
2387
|
+
SHOULD be present when the message is delivered. Systems using RFC
|
2388
|
+
822 syntax with non-SMTP transports SHOULD designate an unambiguous
|
2389
|
+
address, associated with the transport envelope, to which error
|
2390
|
+
reports (e.g., non-delivery messages) should be sent.
|
2391
|
+
|
2392
|
+
Historical note: Text in RFC 822 that appears to contradict the use
|
2393
|
+
of the Return-path header (or the envelope reverse path address from
|
2394
|
+
the MAIL command) as the destination for error messages is not
|
2395
|
+
applicable on the Internet. The reverse path address (as copied into
|
2396
|
+
the Return-path) MUST be used as the target of any mail containing
|
2397
|
+
delivery error messages.
|
2398
|
+
|
2399
|
+
In particular:
|
2400
|
+
|
2401
|
+
- a gateway from SMTP->elsewhere SHOULD insert a return-path header,
|
2402
|
+
unless it is known that the "elsewhere" transport also uses
|
2403
|
+
Internet domain addresses and maintains the envelope sender
|
2404
|
+
address separately.
|
2405
|
+
|
2406
|
+
- a gateway from elsewhere->SMTP SHOULD delete any return-path
|
2407
|
+
header present in the message, and either copy that information to
|
2408
|
+
the SMTP envelope or combine it with information present in the
|
2409
|
+
envelope of the other transport system to construct the reverse
|
2410
|
+
path argument to the MAIL command in the SMTP envelope.
|
2411
|
+
|
2412
|
+
The server must give special treatment to cases in which the
|
2413
|
+
processing following the end of mail data indication is only
|
2414
|
+
partially successful. This could happen if, after accepting several
|
2415
|
+
recipients and the mail data, the SMTP server finds that the mail
|
2416
|
+
data could be successfully delivered to some, but not all, of the
|
2417
|
+
recipients. In such cases, the response to the DATA command MUST be
|
2418
|
+
an OK reply. However, the SMTP server MUST compose and send an
|
2419
|
+
"undeliverable mail" notification message to the originator of the
|
2420
|
+
message.
|
2421
|
+
|
2422
|
+
A single notification listing all of the failed recipients or
|
2423
|
+
separate notification messages MUST be sent for each failed
|
2424
|
+
recipient. For economy of processing by the sender, the former is
|
2425
|
+
preferred when possible. All undeliverable mail notification
|
2426
|
+
messages are sent using the MAIL command (even if they result from
|
2427
|
+
processing the obsolete SEND, SOML, or SAML commands) and use a null
|
2428
|
+
return path as discussed in section 3.7.
|
2429
|
+
|
2430
|
+
The time stamp line and the return path line are formally defined as
|
2431
|
+
follows:
|
2432
|
+
|
2433
|
+
Return-path-line = "Return-Path:" FWS Reverse-path <CRLF>
|
2434
|
+
|
2435
|
+
Time-stamp-line = "Received:" FWS Stamp <CRLF>
|
2436
|
+
|
2437
|
+
Stamp = From-domain By-domain Opt-info ";" FWS date-time
|
2438
|
+
|
2439
|
+
; where "date-time" is as defined in [32]
|
2440
|
+
; but the "obs-" forms, especially two-digit
|
2441
|
+
; years, are prohibited in SMTP and MUST NOT be used.
|
2442
|
+
|
2443
|
+
From-domain = "FROM" FWS Extended-Domain CFWS
|
2444
|
+
|
2445
|
+
By-domain = "BY" FWS Extended-Domain CFWS
|
2446
|
+
|
2447
|
+
Extended-Domain = Domain /
|
2448
|
+
( Domain FWS "(" TCP-info ")" ) /
|
2449
|
+
( Address-literal FWS "(" TCP-info ")" )
|
2450
|
+
|
2451
|
+
TCP-info = Address-literal / ( Domain FWS Address-literal )
|
2452
|
+
; Information derived by server from TCP connection
|
2453
|
+
; not client EHLO.
|
2454
|
+
|
2455
|
+
Opt-info = [Via] [With] [ID] [For]
|
2456
|
+
|
2457
|
+
Via = "VIA" FWS Link CFWS
|
2458
|
+
|
2459
|
+
With = "WITH" FWS Protocol CFWS
|
2460
|
+
|
2461
|
+
ID = "ID" FWS String / msg-id CFWS
|
2462
|
+
|
2463
|
+
For = "FOR" FWS 1*( Path / Mailbox ) CFWS
|
2464
|
+
|
2465
|
+
Link = "TCP" / Addtl-Link
|
2466
|
+
Addtl-Link = Atom
|
2467
|
+
; Additional standard names for links are registered with the
|
2468
|
+
; Internet Assigned Numbers Authority (IANA). "Via" is
|
2469
|
+
; primarily of value with non-Internet transports. SMTP
|
2470
|
+
|
2471
|
+
; servers SHOULD NOT use unregistered names.
|
2472
|
+
Protocol = "ESMTP" / "SMTP" / Attdl-Protocol
|
2473
|
+
Attdl-Protocol = Atom
|
2474
|
+
; Additional standard names for protocols are registered with the
|
2475
|
+
; Internet Assigned Numbers Authority (IANA). SMTP servers
|
2476
|
+
; SHOULD NOT use unregistered names.
|
2477
|
+
|
2478
|
+
4.5 Additional Implementation Issues
|
2479
|
+
|
2480
|
+
4.5.1 Minimum Implementation
|
2481
|
+
|
2482
|
+
In order to make SMTP workable, the following minimum implementation
|
2483
|
+
is required for all receivers. The following commands MUST be
|
2484
|
+
supported to conform to this specification:
|
2485
|
+
|
2486
|
+
EHLO
|
2487
|
+
HELO
|
2488
|
+
MAIL
|
2489
|
+
RCPT
|
2490
|
+
DATA
|
2491
|
+
RSET
|
2492
|
+
NOOP
|
2493
|
+
QUIT
|
2494
|
+
VRFY
|
2495
|
+
|
2496
|
+
Any system that includes an SMTP server supporting mail relaying or
|
2497
|
+
delivery MUST support the reserved mailbox "postmaster" as a case-
|
2498
|
+
insensitive local name. This postmaster address is not strictly
|
2499
|
+
necessary if the server always returns 554 on connection opening (as
|
2500
|
+
described in section 3.1). The requirement to accept mail for
|
2501
|
+
postmaster implies that RCPT commands which specify a mailbox for
|
2502
|
+
postmaster at any of the domains for which the SMTP server provides
|
2503
|
+
mail service, as well as the special case of "RCPT TO:<Postmaster>"
|
2504
|
+
(with no domain specification), MUST be supported.
|
2505
|
+
|
2506
|
+
SMTP systems are expected to make every reasonable effort to accept
|
2507
|
+
mail directed to Postmaster from any other system on the Internet.
|
2508
|
+
In extreme cases --such as to contain a denial of service attack or
|
2509
|
+
other breach of security-- an SMTP server may block mail directed to
|
2510
|
+
Postmaster. However, such arrangements SHOULD be narrowly tailored
|
2511
|
+
so as to avoid blocking messages which are not part of such attacks.
|
2512
|
+
|
2513
|
+
4.5.2 Transparency
|
2514
|
+
|
2515
|
+
Without some provision for data transparency, the character sequence
|
2516
|
+
"<CRLF>.<CRLF>" ends the mail text and cannot be sent by the user.
|
2517
|
+
In general, users are not aware of such "forbidden" sequences. To
|
2518
|
+
|
2519
|
+
allow all user composed text to be transmitted transparently, the
|
2520
|
+
following procedures are used:
|
2521
|
+
|
2522
|
+
- Before sending a line of mail text, the SMTP client checks the
|
2523
|
+
first character of the line. If it is a period, one additional
|
2524
|
+
period is inserted at the beginning of the line.
|
2525
|
+
|
2526
|
+
- When a line of mail text is received by the SMTP server, it checks
|
2527
|
+
the line. If the line is composed of a single period, it is
|
2528
|
+
treated as the end of mail indicator. If the first character is a
|
2529
|
+
period and there are other characters on the line, the first
|
2530
|
+
character is deleted.
|
2531
|
+
|
2532
|
+
The mail data may contain any of the 128 ASCII characters. All
|
2533
|
+
characters are to be delivered to the recipient's mailbox, including
|
2534
|
+
spaces, vertical and horizontal tabs, and other control characters.
|
2535
|
+
If the transmission channel provides an 8-bit byte (octet) data
|
2536
|
+
stream, the 7-bit ASCII codes are transmitted right justified in the
|
2537
|
+
octets, with the high order bits cleared to zero. See 3.7 for
|
2538
|
+
special treatment of these conditions in SMTP systems serving a relay
|
2539
|
+
function.
|
2540
|
+
|
2541
|
+
In some systems it may be necessary to transform the data as it is
|
2542
|
+
received and stored. This may be necessary for hosts that use a
|
2543
|
+
different character set than ASCII as their local character set, that
|
2544
|
+
store data in records rather than strings, or which use special
|
2545
|
+
character sequences as delimiters inside mailboxes. If such
|
2546
|
+
transformations are necessary, they MUST be reversible, especially if
|
2547
|
+
they are applied to mail being relayed.
|
2548
|
+
|
2549
|
+
4.5.3 Sizes and Timeouts
|
2550
|
+
|
2551
|
+
4.5.3.1 Size limits and minimums
|
2552
|
+
|
2553
|
+
There are several objects that have required minimum/maximum sizes.
|
2554
|
+
Every implementation MUST be able to receive objects of at least
|
2555
|
+
these sizes. Objects larger than these sizes SHOULD be avoided when
|
2556
|
+
possible. However, some Internet mail constructs such as encoded
|
2557
|
+
X.400 addresses [16] will often require larger objects: clients MAY
|
2558
|
+
attempt to transmit these, but MUST be prepared for a server to
|
2559
|
+
reject them if they cannot be handled by it. To the maximum extent
|
2560
|
+
possible, implementation techniques which impose no limits on the
|
2561
|
+
length of these objects should be used.
|
2562
|
+
|
2563
|
+
local-part
|
2564
|
+
The maximum total length of a user name or other local-part is 64
|
2565
|
+
characters.
|
2566
|
+
|
2567
|
+
domain
|
2568
|
+
The maximum total length of a domain name or number is 255
|
2569
|
+
characters.
|
2570
|
+
|
2571
|
+
path
|
2572
|
+
The maximum total length of a reverse-path or forward-path is 256
|
2573
|
+
characters (including the punctuation and element separators).
|
2574
|
+
|
2575
|
+
command line
|
2576
|
+
The maximum total length of a command line including the command
|
2577
|
+
word and the <CRLF> is 512 characters. SMTP extensions may be
|
2578
|
+
used to increase this limit.
|
2579
|
+
|
2580
|
+
reply line
|
2581
|
+
The maximum total length of a reply line including the reply code
|
2582
|
+
and the <CRLF> is 512 characters. More information may be
|
2583
|
+
conveyed through multiple-line replies.
|
2584
|
+
|
2585
|
+
text line
|
2586
|
+
The maximum total length of a text line including the <CRLF> is
|
2587
|
+
1000 characters (not counting the leading dot duplicated for
|
2588
|
+
transparency). This number may be increased by the use of SMTP
|
2589
|
+
Service Extensions.
|
2590
|
+
|
2591
|
+
message content
|
2592
|
+
The maximum total length of a message content (including any
|
2593
|
+
message headers as well as the message body) MUST BE at least 64K
|
2594
|
+
octets. Since the introduction of Internet standards for
|
2595
|
+
multimedia mail [12], message lengths on the Internet have grown
|
2596
|
+
dramatically, and message size restrictions should be avoided if
|
2597
|
+
at all possible. SMTP server systems that must impose
|
2598
|
+
restrictions SHOULD implement the "SIZE" service extension [18],
|
2599
|
+
and SMTP client systems that will send large messages SHOULD
|
2600
|
+
utilize it when possible.
|
2601
|
+
|
2602
|
+
recipients buffer
|
2603
|
+
The minimum total number of recipients that must be buffered is
|
2604
|
+
100 recipients. Rejection of messages (for excessive recipients)
|
2605
|
+
with fewer than 100 RCPT commands is a violation of this
|
2606
|
+
specification. The general principle that relaying SMTP servers
|
2607
|
+
MUST NOT, and delivery SMTP servers SHOULD NOT, perform validation
|
2608
|
+
tests on message headers suggests that rejecting a message based
|
2609
|
+
on the total number of recipients shown in header fields is to be
|
2610
|
+
discouraged. A server which imposes a limit on the number of
|
2611
|
+
recipients MUST behave in an orderly fashion, such as to reject
|
2612
|
+
additional addresses over its limit rather than silently
|
2613
|
+
discarding addresses previously accepted. A client that needs to
|
2614
|
+
|
2615
|
+
deliver a message containing over 100 RCPT commands SHOULD be
|
2616
|
+
prepared to transmit in 100-recipient "chunks" if the server
|
2617
|
+
declines to accept more than 100 recipients in a single message.
|
2618
|
+
|
2619
|
+
Errors due to exceeding these limits may be reported by using the
|
2620
|
+
reply codes. Some examples of reply codes are:
|
2621
|
+
|
2622
|
+
500 Line too long.
|
2623
|
+
or
|
2624
|
+
501 Path too long
|
2625
|
+
or
|
2626
|
+
452 Too many recipients (see below)
|
2627
|
+
or
|
2628
|
+
552 Too much mail data.
|
2629
|
+
|
2630
|
+
RFC 821 [30] incorrectly listed the error where an SMTP server
|
2631
|
+
exhausts its implementation limit on the number of RCPT commands
|
2632
|
+
("too many recipients") as having reply code 552. The correct reply
|
2633
|
+
code for this condition is 452. Clients SHOULD treat a 552 code in
|
2634
|
+
this case as a temporary, rather than permanent, failure so the logic
|
2635
|
+
below works.
|
2636
|
+
|
2637
|
+
When a conforming SMTP server encounters this condition, it has at
|
2638
|
+
least 100 successful RCPT commands in its recipients buffer. If the
|
2639
|
+
server is able to accept the message, then at least these 100
|
2640
|
+
addresses will be removed from the SMTP client's queue. When the
|
2641
|
+
client attempts retransmission of those addresses which received 452
|
2642
|
+
responses, at least 100 of these will be able to fit in the SMTP
|
2643
|
+
server's recipients buffer. Each retransmission attempt which is
|
2644
|
+
able to deliver anything will be able to dispose of at least 100 of
|
2645
|
+
these recipients.
|
2646
|
+
|
2647
|
+
If an SMTP server has an implementation limit on the number of RCPT
|
2648
|
+
commands and this limit is exhausted, it MUST use a response code of
|
2649
|
+
452 (but the client SHOULD also be prepared for a 552, as noted
|
2650
|
+
above). If the server has a configured site-policy limitation on the
|
2651
|
+
number of RCPT commands, it MAY instead use a 5XX response code.
|
2652
|
+
This would be most appropriate if the policy limitation was intended
|
2653
|
+
to apply if the total recipient count for a particular message body
|
2654
|
+
were enforced even if that message body was sent in multiple mail
|
2655
|
+
transactions.
|
2656
|
+
|
2657
|
+
4.5.3.2 Timeouts
|
2658
|
+
|
2659
|
+
An SMTP client MUST provide a timeout mechanism. It MUST use per-
|
2660
|
+
command timeouts rather than somehow trying to time the entire mail
|
2661
|
+
transaction. Timeouts SHOULD be easily reconfigurable, preferably
|
2662
|
+
without recompiling the SMTP code. To implement this, a timer is set
|
2663
|
+
|
2664
|
+
for each SMTP command and for each buffer of the data transfer. The
|
2665
|
+
latter means that the overall timeout is inherently proportional to
|
2666
|
+
the size of the message.
|
2667
|
+
|
2668
|
+
Based on extensive experience with busy mail-relay hosts, the minimum
|
2669
|
+
per-command timeout values SHOULD be as follows:
|
2670
|
+
|
2671
|
+
Initial 220 Message: 5 minutes
|
2672
|
+
An SMTP client process needs to distinguish between a failed TCP
|
2673
|
+
connection and a delay in receiving the initial 220 greeting
|
2674
|
+
message. Many SMTP servers accept a TCP connection but delay
|
2675
|
+
delivery of the 220 message until their system load permits more
|
2676
|
+
mail to be processed.
|
2677
|
+
|
2678
|
+
MAIL Command: 5 minutes
|
2679
|
+
|
2680
|
+
RCPT Command: 5 minutes
|
2681
|
+
A longer timeout is required if processing of mailing lists and
|
2682
|
+
aliases is not deferred until after the message was accepted.
|
2683
|
+
|
2684
|
+
DATA Initiation: 2 minutes
|
2685
|
+
This is while awaiting the "354 Start Input" reply to a DATA
|
2686
|
+
command.
|
2687
|
+
|
2688
|
+
Data Block: 3 minutes
|
2689
|
+
This is while awaiting the completion of each TCP SEND call
|
2690
|
+
transmitting a chunk of data.
|
2691
|
+
|
2692
|
+
DATA Termination: 10 minutes.
|
2693
|
+
This is while awaiting the "250 OK" reply. When the receiver gets
|
2694
|
+
the final period terminating the message data, it typically
|
2695
|
+
performs processing to deliver the message to a user mailbox. A
|
2696
|
+
spurious timeout at this point would be very wasteful and would
|
2697
|
+
typically result in delivery of multiple copies of the message,
|
2698
|
+
since it has been successfully sent and the server has accepted
|
2699
|
+
responsibility for delivery. See section 6.1 for additional
|
2700
|
+
discussion.
|
2701
|
+
|
2702
|
+
An SMTP server SHOULD have a timeout of at least 5 minutes while it
|
2703
|
+
is awaiting the next command from the sender.
|
2704
|
+
|
2705
|
+
4.5.4 Retry Strategies
|
2706
|
+
|
2707
|
+
The common structure of a host SMTP implementation includes user
|
2708
|
+
mailboxes, one or more areas for queuing messages in transit, and one
|
2709
|
+
or more daemon processes for sending and receiving mail. The exact
|
2710
|
+
structure will vary depending on the needs of the users on the host
|
2711
|
+
|
2712
|
+
and the number and size of mailing lists supported by the host. We
|
2713
|
+
describe several optimizations that have proved helpful, particularly
|
2714
|
+
for mailers supporting high traffic levels.
|
2715
|
+
|
2716
|
+
Any queuing strategy MUST include timeouts on all activities on a
|
2717
|
+
per-command basis. A queuing strategy MUST NOT send error messages
|
2718
|
+
in response to error messages under any circumstances.
|
2719
|
+
|
2720
|
+
4.5.4.1 Sending Strategy
|
2721
|
+
|
2722
|
+
The general model for an SMTP client is one or more processes that
|
2723
|
+
periodically attempt to transmit outgoing mail. In a typical system,
|
2724
|
+
the program that composes a message has some method for requesting
|
2725
|
+
immediate attention for a new piece of outgoing mail, while mail that
|
2726
|
+
cannot be transmitted immediately MUST be queued and periodically
|
2727
|
+
retried by the sender. A mail queue entry will include not only the
|
2728
|
+
message itself but also the envelope information.
|
2729
|
+
|
2730
|
+
The sender MUST delay retrying a particular destination after one
|
2731
|
+
attempt has failed. In general, the retry interval SHOULD be at
|
2732
|
+
least 30 minutes; however, more sophisticated and variable strategies
|
2733
|
+
will be beneficial when the SMTP client can determine the reason for
|
2734
|
+
non-delivery.
|
2735
|
+
|
2736
|
+
Retries continue until the message is transmitted or the sender gives
|
2737
|
+
up; the give-up time generally needs to be at least 4-5 days. The
|
2738
|
+
parameters to the retry algorithm MUST be configurable.
|
2739
|
+
|
2740
|
+
A client SHOULD keep a list of hosts it cannot reach and
|
2741
|
+
corresponding connection timeouts, rather than just retrying queued
|
2742
|
+
mail items.
|
2743
|
+
|
2744
|
+
Experience suggests that failures are typically transient (the target
|
2745
|
+
system or its connection has crashed), favoring a policy of two
|
2746
|
+
connection attempts in the first hour the message is in the queue,
|
2747
|
+
and then backing off to one every two or three hours.
|
2748
|
+
|
2749
|
+
The SMTP client can shorten the queuing delay in cooperation with the
|
2750
|
+
SMTP server. For example, if mail is received from a particular
|
2751
|
+
address, it is likely that mail queued for that host can now be sent.
|
2752
|
+
Application of this principle may, in many cases, eliminate the
|
2753
|
+
requirement for an explicit "send queues now" function such as ETRN
|
2754
|
+
[9].
|
2755
|
+
|
2756
|
+
The strategy may be further modified as a result of multiple
|
2757
|
+
addresses per host (see below) to optimize delivery time vs. resource
|
2758
|
+
usage.
|
2759
|
+
|
2760
|
+
An SMTP client may have a large queue of messages for each
|
2761
|
+
unavailable destination host. If all of these messages were retried
|
2762
|
+
in every retry cycle, there would be excessive Internet overhead and
|
2763
|
+
the sending system would be blocked for a long period. Note that an
|
2764
|
+
SMTP client can generally determine that a delivery attempt has
|
2765
|
+
failed only after a timeout of several minutes and even a one-minute
|
2766
|
+
timeout per connection will result in a very large delay if retries
|
2767
|
+
are repeated for dozens, or even hundreds, of queued messages to the
|
2768
|
+
same host.
|
2769
|
+
|
2770
|
+
At the same time, SMTP clients SHOULD use great care in caching
|
2771
|
+
negative responses from servers. In an extreme case, if EHLO is
|
2772
|
+
issued multiple times during the same SMTP connection, different
|
2773
|
+
answers may be returned by the server. More significantly, 5yz
|
2774
|
+
responses to the MAIL command MUST NOT be cached.
|
2775
|
+
|
2776
|
+
When a mail message is to be delivered to multiple recipients, and
|
2777
|
+
the SMTP server to which a copy of the message is to be sent is the
|
2778
|
+
same for multiple recipients, then only one copy of the message
|
2779
|
+
SHOULD be transmitted. That is, the SMTP client SHOULD use the
|
2780
|
+
command sequence: MAIL, RCPT, RCPT,... RCPT, DATA instead of the
|
2781
|
+
sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there
|
2782
|
+
are very many addresses, a limit on the number of RCPT commands per
|
2783
|
+
MAIL command MAY be imposed. Implementation of this efficiency
|
2784
|
+
feature is strongly encouraged.
|
2785
|
+
|
2786
|
+
Similarly, to achieve timely delivery, the SMTP client MAY support
|
2787
|
+
multiple concurrent outgoing mail transactions. However, some limit
|
2788
|
+
may be appropriate to protect the host from devoting all its
|
2789
|
+
resources to mail.
|
2790
|
+
|
2791
|
+
4.5.4.2 Receiving Strategy
|
2792
|
+
|
2793
|
+
The SMTP server SHOULD attempt to keep a pending listen on the SMTP
|
2794
|
+
port at all times. This requires the support of multiple incoming
|
2795
|
+
TCP connections for SMTP. Some limit MAY be imposed but servers that
|
2796
|
+
cannot handle more than one SMTP transaction at a time are not in
|
2797
|
+
conformance with the intent of this specification.
|
2798
|
+
|
2799
|
+
As discussed above, when the SMTP server receives mail from a
|
2800
|
+
particular host address, it could activate its own SMTP queuing
|
2801
|
+
mechanisms to retry any mail pending for that host address.
|
2802
|
+
|
2803
|
+
4.5.5 Messages with a null reverse-path
|
2804
|
+
|
2805
|
+
There are several types of notification messages which are required
|
2806
|
+
by existing and proposed standards to be sent with a null reverse
|
2807
|
+
path, namely non-delivery notifications as discussed in section 3.7,
|
2808
|
+
|
2809
|
+
other kinds of Delivery Status Notifications (DSNs) [24], and also
|
2810
|
+
Message Disposition Notifications (MDNs) [10]. All of these kinds of
|
2811
|
+
messages are notifications about a previous message, and they are
|
2812
|
+
sent to the reverse-path of the previous mail message. (If the
|
2813
|
+
delivery of such a notification message fails, that usually indicates
|
2814
|
+
a problem with the mail system of the host to which the notification
|
2815
|
+
message is addressed. For this reason, at some hosts the MTA is set
|
2816
|
+
up to forward such failed notification messages to someone who is
|
2817
|
+
able to fix problems with the mail system, e.g., via the postmaster
|
2818
|
+
alias.)
|
2819
|
+
|
2820
|
+
All other types of messages (i.e., any message which is not required
|
2821
|
+
by a standards-track RFC to have a null reverse-path) SHOULD be sent
|
2822
|
+
with with a valid, non-null reverse-path.
|
2823
|
+
|
2824
|
+
Implementors of automated email processors should be careful to make
|
2825
|
+
sure that the various kinds of messages with null reverse-path are
|
2826
|
+
handled correctly, in particular such systems SHOULD NOT reply to
|
2827
|
+
messages with null reverse-path.
|
2828
|
+
|
2829
|
+
5. Address Resolution and Mail Handling
|
2830
|
+
|
2831
|
+
Once an SMTP client lexically identifies a domain to which mail will
|
2832
|
+
be delivered for processing (as described in sections 3.6 and 3.7), a
|
2833
|
+
DNS lookup MUST be performed to resolve the domain name [22]. The
|
2834
|
+
names are expected to be fully-qualified domain names (FQDNs):
|
2835
|
+
mechanisms for inferring FQDNs from partial names or local aliases
|
2836
|
+
are outside of this specification and, due to a history of problems,
|
2837
|
+
are generally discouraged. The lookup first attempts to locate an MX
|
2838
|
+
record associated with the name. If a CNAME record is found instead,
|
2839
|
+
the resulting name is processed as if it were the initial name. If
|
2840
|
+
no MX records are found, but an A RR is found, the A RR is treated as
|
2841
|
+
if it was associated with an implicit MX RR, with a preference of 0,
|
2842
|
+
pointing to that host. If one or more MX RRs are found for a given
|
2843
|
+
name, SMTP systems MUST NOT utilize any A RRs associated with that
|
2844
|
+
name unless they are located using the MX RRs; the "implicit MX" rule
|
2845
|
+
above applies only if there are no MX records present. If MX records
|
2846
|
+
are present, but none of them are usable, this situation MUST be
|
2847
|
+
reported as an error.
|
2848
|
+
|
2849
|
+
When the lookup succeeds, the mapping can result in a list of
|
2850
|
+
alternative delivery addresses rather than a single address, because
|
2851
|
+
of multiple MX records, multihoming, or both. To provide reliable
|
2852
|
+
mail transmission, the SMTP client MUST be able to try (and retry)
|
2853
|
+
each of the relevant addresses in this list in order, until a
|
2854
|
+
delivery attempt succeeds. However, there MAY also be a configurable
|
2855
|
+
limit on the number of alternate addresses that can be tried. In any
|
2856
|
+
case, the SMTP client SHOULD try at least two addresses.
|
2857
|
+
|
2858
|
+
Two types of information is used to rank the host addresses: multiple
|
2859
|
+
MX records, and multihomed hosts.
|
2860
|
+
|
2861
|
+
Multiple MX records contain a preference indication that MUST be used
|
2862
|
+
in sorting (see below). Lower numbers are more preferred than higher
|
2863
|
+
ones. If there are multiple destinations with the same preference
|
2864
|
+
and there is no clear reason to favor one (e.g., by recognition of an
|
2865
|
+
easily-reached address), then the sender-SMTP MUST randomize them to
|
2866
|
+
spread the load across multiple mail exchangers for a specific
|
2867
|
+
organization.
|
2868
|
+
|
2869
|
+
The destination host (perhaps taken from the preferred MX record) may
|
2870
|
+
be multihomed, in which case the domain name resolver will return a
|
2871
|
+
list of alternative IP addresses. It is the responsibility of the
|
2872
|
+
domain name resolver interface to have ordered this list by
|
2873
|
+
decreasing preference if necessary, and SMTP MUST try them in the
|
2874
|
+
order presented.
|
2875
|
+
|
2876
|
+
Although the capability to try multiple alternative addresses is
|
2877
|
+
required, specific installations may want to limit or disable the use
|
2878
|
+
of alternative addresses. The question of whether a sender should
|
2879
|
+
attempt retries using the different addresses of a multihomed host
|
2880
|
+
has been controversial. The main argument for using the multiple
|
2881
|
+
addresses is that it maximizes the probability of timely delivery,
|
2882
|
+
and indeed sometimes the probability of any delivery; the counter-
|
2883
|
+
argument is that it may result in unnecessary resource use. Note
|
2884
|
+
that resource use is also strongly determined by the sending strategy
|
2885
|
+
discussed in section 4.5.4.1.
|
2886
|
+
|
2887
|
+
If an SMTP server receives a message with a destination for which it
|
2888
|
+
is a designated Mail eXchanger, it MAY relay the message (potentially
|
2889
|
+
after having rewritten the MAIL FROM and/or RCPT TO addresses), make
|
2890
|
+
final delivery of the message, or hand it off using some mechanism
|
2891
|
+
outside the SMTP-provided transport environment. Of course, neither
|
2892
|
+
of the latter require that the list of MX records be examined
|
2893
|
+
further.
|
2894
|
+
|
2895
|
+
If it determines that it should relay the message without rewriting
|
2896
|
+
the address, it MUST sort the MX records to determine candidates for
|
2897
|
+
delivery. The records are first ordered by preference, with the
|
2898
|
+
lowest-numbered records being most preferred. The relay host MUST
|
2899
|
+
then inspect the list for any of the names or addresses by which it
|
2900
|
+
might be known in mail transactions. If a matching record is found,
|
2901
|
+
all records at that preference level and higher-numbered ones MUST be
|
2902
|
+
discarded from consideration. If there are no records left at that
|
2903
|
+
point, it is an error condition, and the message MUST be returned as
|
2904
|
+
undeliverable. If records do remain, they SHOULD be tried, best
|
2905
|
+
preference first, as described above.
|
2906
|
+
|
2907
|
+
6. Problem Detection and Handling
|
2908
|
+
|
2909
|
+
6.1 Reliable Delivery and Replies by Email
|
2910
|
+
|
2911
|
+
When the receiver-SMTP accepts a piece of mail (by sending a "250 OK"
|
2912
|
+
message in response to DATA), it is accepting responsibility for
|
2913
|
+
delivering or relaying the message. It must take this responsibility
|
2914
|
+
seriously. It MUST NOT lose the message for frivolous reasons, such
|
2915
|
+
as because the host later crashes or because of a predictable
|
2916
|
+
resource shortage.
|
2917
|
+
|
2918
|
+
If there is a delivery failure after acceptance of a message, the
|
2919
|
+
receiver-SMTP MUST formulate and mail a notification message. This
|
2920
|
+
notification MUST be sent using a null ("<>") reverse path in the
|
2921
|
+
envelope. The recipient of this notification MUST be the address
|
2922
|
+
from the envelope return path (or the Return-Path: line). However,
|
2923
|
+
if this address is null ("<>"), the receiver-SMTP MUST NOT send a
|
2924
|
+
notification. Obviously, nothing in this section can or should
|
2925
|
+
prohibit local decisions (i.e., as part of the same system
|
2926
|
+
environment as the receiver-SMTP) to log or otherwise transmit
|
2927
|
+
information about null address events locally if that is desired. If
|
2928
|
+
the address is an explicit source route, it MUST be stripped down to
|
2929
|
+
its final hop.
|
2930
|
+
|
2931
|
+
For example, suppose that an error notification must be sent for a
|
2932
|
+
message that arrived with:
|
2933
|
+
|
2934
|
+
MAIL FROM:<@a,@b:user@d>
|
2935
|
+
|
2936
|
+
The notification message MUST be sent using:
|
2937
|
+
|
2938
|
+
RCPT TO:<user@d>
|
2939
|
+
|
2940
|
+
Some delivery failures after the message is accepted by SMTP will be
|
2941
|
+
unavoidable. For example, it may be impossible for the receiving
|
2942
|
+
SMTP server to validate all the delivery addresses in RCPT command(s)
|
2943
|
+
due to a "soft" domain system error, because the target is a mailing
|
2944
|
+
list (see earlier discussion of RCPT), or because the server is
|
2945
|
+
acting as a relay and has no immediate access to the delivering
|
2946
|
+
system.
|
2947
|
+
|
2948
|
+
To avoid receiving duplicate messages as the result of timeouts, a
|
2949
|
+
receiver-SMTP MUST seek to minimize the time required to respond to
|
2950
|
+
the final <CRLF>.<CRLF> end of data indicator. See RFC 1047 [28] for
|
2951
|
+
a discussion of this problem.
|
2952
|
+
|
2953
|
+
6.2 Loop Detection
|
2954
|
+
|
2955
|
+
Simple counting of the number of "Received:" headers in a message has
|
2956
|
+
proven to be an effective, although rarely optimal, method of
|
2957
|
+
detecting loops in mail systems. SMTP servers using this technique
|
2958
|
+
SHOULD use a large rejection threshold, normally at least 100
|
2959
|
+
Received entries. Whatever mechanisms are used, servers MUST contain
|
2960
|
+
provisions for detecting and stopping trivial loops.
|
2961
|
+
|
2962
|
+
6.3 Compensating for Irregularities
|
2963
|
+
|
2964
|
+
Unfortunately, variations, creative interpretations, and outright
|
2965
|
+
violations of Internet mail protocols do occur; some would suggest
|
2966
|
+
that they occur quite frequently. The debate as to whether a well-
|
2967
|
+
behaved SMTP receiver or relay should reject a malformed message,
|
2968
|
+
attempt to pass it on unchanged, or attempt to repair it to increase
|
2969
|
+
the odds of successful delivery (or subsequent reply) began almost
|
2970
|
+
with the dawn of structured network mail and shows no signs of
|
2971
|
+
abating. Advocates of rejection claim that attempted repairs are
|
2972
|
+
rarely completely adequate and that rejection of bad messages is the
|
2973
|
+
only way to get the offending software repaired. Advocates of
|
2974
|
+
"repair" or "deliver no matter what" argue that users prefer that
|
2975
|
+
mail go through it if at all possible and that there are significant
|
2976
|
+
market pressures in that direction. In practice, these market
|
2977
|
+
pressures may be more important to particular vendors than strict
|
2978
|
+
conformance to the standards, regardless of the preference of the
|
2979
|
+
actual developers.
|
2980
|
+
|
2981
|
+
The problems associated with ill-formed messages were exacerbated by
|
2982
|
+
the introduction of the split-UA mail reading protocols [3, 26, 5,
|
2983
|
+
21]. These protocols have encouraged the use of SMTP as a posting
|
2984
|
+
protocol, and SMTP servers as relay systems for these client hosts
|
2985
|
+
(which are often only intermittently connected to the Internet).
|
2986
|
+
Historically, many of those client machines lacked some of the
|
2987
|
+
mechanisms and information assumed by SMTP (and indeed, by the mail
|
2988
|
+
format protocol [7]). Some could not keep adequate track of time;
|
2989
|
+
others had no concept of time zones; still others could not identify
|
2990
|
+
their own names or addresses; and, of course, none could satisfy the
|
2991
|
+
assumptions that underlay RFC 822's conception of authenticated
|
2992
|
+
addresses.
|
2993
|
+
|
2994
|
+
In response to these weak SMTP clients, many SMTP systems now
|
2995
|
+
complete messages that are delivered to them in incomplete or
|
2996
|
+
incorrect form. This strategy is generally considered appropriate
|
2997
|
+
when the server can identify or authenticate the client, and there
|
2998
|
+
are prior agreements between them. By contrast, there is at best
|
2999
|
+
great concern about fixes applied by a relay or delivery SMTP server
|
3000
|
+
that has little or no knowledge of the user or client machine.
|
3001
|
+
|
3002
|
+
The following changes to a message being processed MAY be applied
|
3003
|
+
when necessary by an originating SMTP server, or one used as the
|
3004
|
+
target of SMTP as an initial posting protocol:
|
3005
|
+
|
3006
|
+
- Addition of a message-id field when none appears
|
3007
|
+
|
3008
|
+
- Addition of a date, time or time zone when none appears
|
3009
|
+
|
3010
|
+
- Correction of addresses to proper FQDN format
|
3011
|
+
|
3012
|
+
The less information the server has about the client, the less likely
|
3013
|
+
these changes are to be correct and the more caution and conservatism
|
3014
|
+
should be applied when considering whether or not to perform fixes
|
3015
|
+
and how. These changes MUST NOT be applied by an SMTP server that
|
3016
|
+
provides an intermediate relay function.
|
3017
|
+
|
3018
|
+
In all cases, properly-operating clients supplying correct
|
3019
|
+
information are preferred to corrections by the SMTP server. In all
|
3020
|
+
cases, documentation of actions performed by the servers (in trace
|
3021
|
+
fields and/or header comments) is strongly encouraged.
|
3022
|
+
|
3023
|
+
7. Security Considerations
|
3024
|
+
|
3025
|
+
7.1 Mail Security and Spoofing
|
3026
|
+
|
3027
|
+
SMTP mail is inherently insecure in that it is feasible for even
|
3028
|
+
fairly casual users to negotiate directly with receiving and relaying
|
3029
|
+
SMTP servers and create messages that will trick a naive recipient
|
3030
|
+
into believing that they came from somewhere else. Constructing such
|
3031
|
+
a message so that the "spoofed" behavior cannot be detected by an
|
3032
|
+
expert is somewhat more difficult, but not sufficiently so as to be a
|
3033
|
+
deterrent to someone who is determined and knowledgeable.
|
3034
|
+
Consequently, as knowledge of Internet mail increases, so does the
|
3035
|
+
knowledge that SMTP mail inherently cannot be authenticated, or
|
3036
|
+
integrity checks provided, at the transport level. Real mail
|
3037
|
+
security lies only in end-to-end methods involving the message
|
3038
|
+
bodies, such as those which use digital signatures (see [14] and,
|
3039
|
+
e.g., PGP [4] or S/MIME [31]).
|
3040
|
+
|
3041
|
+
Various protocol extensions and configuration options that provide
|
3042
|
+
authentication at the transport level (e.g., from an SMTP client to
|
3043
|
+
an SMTP server) improve somewhat on the traditional situation
|
3044
|
+
described above. However, unless they are accompanied by careful
|
3045
|
+
handoffs of responsibility in a carefully-designed trust environment,
|
3046
|
+
they remain inherently weaker than end-to-end mechanisms which use
|
3047
|
+
digitally signed messages rather than depending on the integrity of
|
3048
|
+
the transport system.
|
3049
|
+
|
3050
|
+
Efforts to make it more difficult for users to set envelope return
|
3051
|
+
path and header "From" fields to point to valid addresses other than
|
3052
|
+
their own are largely misguided: they frustrate legitimate
|
3053
|
+
applications in which mail is sent by one user on behalf of another
|
3054
|
+
or in which error (or normal) replies should be directed to a special
|
3055
|
+
address. (Systems that provide convenient ways for users to alter
|
3056
|
+
these fields on a per-message basis should accept to establish a
|
3057
|
+
primary and permanent mailbox address for the user so that Sender
|
3058
|
+
fields within the message data can be generated sensibly.)
|
3059
|
+
|
3060
|
+
This specification does not further address the authentication issues
|
3061
|
+
associated with SMTP other than to advocate that useful functionality
|
3062
|
+
not be disabled in the hope of providing some small margin of
|
3063
|
+
protection against an ignorant user who is trying to fake mail.
|
3064
|
+
|
3065
|
+
7.2 "Blind" Copies
|
3066
|
+
|
3067
|
+
Addresses that do not appear in the message headers may appear in the
|
3068
|
+
RCPT commands to an SMTP server for a number of reasons. The two
|
3069
|
+
most common involve the use of a mailing address as a "list exploder"
|
3070
|
+
(a single address that resolves into multiple addresses) and the
|
3071
|
+
appearance of "blind copies". Especially when more than one RCPT
|
3072
|
+
command is present, and in order to avoid defeating some of the
|
3073
|
+
purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy
|
3074
|
+
the full set of RCPT command arguments into the headers, either as
|
3075
|
+
part of trace headers or as informational or private-extension
|
3076
|
+
headers. Since this rule is often violated in practice, and cannot
|
3077
|
+
be enforced, sending SMTP systems that are aware of "bcc" use MAY
|
3078
|
+
find it helpful to send each blind copy as a separate message
|
3079
|
+
transaction containing only a single RCPT command.
|
3080
|
+
|
3081
|
+
There is no inherent relationship between either "reverse" (from
|
3082
|
+
MAIL, SAML, etc., commands) or "forward" (RCPT) addresses in the SMTP
|
3083
|
+
transaction ("envelope") and the addresses in the headers. Receiving
|
3084
|
+
systems SHOULD NOT attempt to deduce such relationships and use them
|
3085
|
+
to alter the headers of the message for delivery. The popular
|
3086
|
+
"Apparently-to" header is a violation of this principle as well as a
|
3087
|
+
common source of unintended information disclosure and SHOULD NOT be
|
3088
|
+
used.
|
3089
|
+
|
3090
|
+
7.3 VRFY, EXPN, and Security
|
3091
|
+
|
3092
|
+
As discussed in section 3.5, individual sites may want to disable
|
3093
|
+
either or both of VRFY or EXPN for security reasons. As a corollary
|
3094
|
+
to the above, implementations that permit this MUST NOT appear to
|
3095
|
+
have verified addresses that are not, in fact, verified. If a site
|
3096
|
+
|
3097
|
+
disables these commands for security reasons, the SMTP server MUST
|
3098
|
+
return a 252 response, rather than a code that could be confused with
|
3099
|
+
successful or unsuccessful verification.
|
3100
|
+
|
3101
|
+
Returning a 250 reply code with the address listed in the VRFY
|
3102
|
+
command after having checked it only for syntax violates this rule.
|
3103
|
+
Of course, an implementation that "supports" VRFY by always returning
|
3104
|
+
550 whether or not the address is valid is equally not in
|
3105
|
+
conformance.
|
3106
|
+
|
3107
|
+
Within the last few years, the contents of mailing lists have become
|
3108
|
+
popular as an address information source for so-called "spammers."
|
3109
|
+
The use of EXPN to "harvest" addresses has increased as list
|
3110
|
+
administrators have installed protections against inappropriate uses
|
3111
|
+
of the lists themselves. Implementations SHOULD still provide
|
3112
|
+
support for EXPN, but sites SHOULD carefully evaluate the tradeoffs.
|
3113
|
+
As authentication mechanisms are introduced into SMTP, some sites may
|
3114
|
+
choose to make EXPN available only to authenticated requestors.
|
3115
|
+
|
3116
|
+
7.4 Information Disclosure in Announcements
|
3117
|
+
|
3118
|
+
There has been an ongoing debate about the tradeoffs between the
|
3119
|
+
debugging advantages of announcing server type and version (and,
|
3120
|
+
sometimes, even server domain name) in the greeting response or in
|
3121
|
+
response to the HELP command and the disadvantages of exposing
|
3122
|
+
information that might be useful in a potential hostile attack. The
|
3123
|
+
utility of the debugging information is beyond doubt. Those who
|
3124
|
+
argue for making it available point out that it is far better to
|
3125
|
+
actually secure an SMTP server rather than hope that trying to
|
3126
|
+
conceal known vulnerabilities by hiding the server's precise identity
|
3127
|
+
will provide more protection. Sites are encouraged to evaluate the
|
3128
|
+
tradeoff with that issue in mind; implementations are strongly
|
3129
|
+
encouraged to minimally provide for making type and version
|
3130
|
+
information available in some way to other network hosts.
|
3131
|
+
|
3132
|
+
7.5 Information Disclosure in Trace Fields
|
3133
|
+
|
3134
|
+
In some circumstances, such as when mail originates from within a LAN
|
3135
|
+
whose hosts are not directly on the public Internet, trace
|
3136
|
+
("Received") fields produced in conformance with this specification
|
3137
|
+
may disclose host names and similar information that would not
|
3138
|
+
normally be available. This ordinarily does not pose a problem, but
|
3139
|
+
sites with special concerns about name disclosure should be aware of
|
3140
|
+
it. Also, the optional FOR clause should be supplied with caution or
|
3141
|
+
not at all when multiple recipients are involved lest it
|
3142
|
+
inadvertently disclose the identities of "blind copy" recipients to
|
3143
|
+
others.
|
3144
|
+
|
3145
|
+
7.6 Information Disclosure in Message Forwarding
|
3146
|
+
|
3147
|
+
As discussed in section 3.4, use of the 251 or 551 reply codes to
|
3148
|
+
identify the replacement address associated with a mailbox may
|
3149
|
+
inadvertently disclose sensitive information. Sites that are
|
3150
|
+
concerned about those issues should ensure that they select and
|
3151
|
+
configure servers appropriately.
|
3152
|
+
|
3153
|
+
7.7 Scope of Operation of SMTP Servers
|
3154
|
+
|
3155
|
+
It is a well-established principle that an SMTP server may refuse to
|
3156
|
+
accept mail for any operational or technical reason that makes sense
|
3157
|
+
to the site providing the server. However, cooperation among sites
|
3158
|
+
and installations makes the Internet possible. If sites take
|
3159
|
+
excessive advantage of the right to reject traffic, the ubiquity of
|
3160
|
+
email availability (one of the strengths of the Internet) will be
|
3161
|
+
threatened; considerable care should be taken and balance maintained
|
3162
|
+
if a site decides to be selective about the traffic it will accept
|
3163
|
+
and process.
|
3164
|
+
|
3165
|
+
In recent years, use of the relay function through arbitrary sites
|
3166
|
+
has been used as part of hostile efforts to hide the actual origins
|
3167
|
+
of mail. Some sites have decided to limit the use of the relay
|
3168
|
+
function to known or identifiable sources, and implementations SHOULD
|
3169
|
+
provide the capability to perform this type of filtering. When mail
|
3170
|
+
is rejected for these or other policy reasons, a 550 code SHOULD be
|
3171
|
+
used in response to EHLO, MAIL, or RCPT as appropriate.
|
3172
|
+
|
3173
|
+
8. IANA Considerations
|
3174
|
+
|
3175
|
+
IANA will maintain three registries in support of this specification.
|
3176
|
+
The first consists of SMTP service extensions with the associated
|
3177
|
+
keywords, and, as needed, parameters and verbs. As specified in
|
3178
|
+
section 2.2.2, no entry may be made in this registry that starts in
|
3179
|
+
an "X". Entries may be made only for service extensions (and
|
3180
|
+
associated keywords, parameters, or verbs) that are defined in
|
3181
|
+
standards-track or experimental RFCs specifically approved by the
|
3182
|
+
IESG for this purpose.
|
3183
|
+
|
3184
|
+
The second registry consists of "tags" that identify forms of domain
|
3185
|
+
literals other than those for IPv4 addresses (specified in RFC 821
|
3186
|
+
and in this document) and IPv6 addresses (specified in this
|
3187
|
+
document). Additional literal types require standardization before
|
3188
|
+
being used; none are anticipated at this time.
|
3189
|
+
|
3190
|
+
The third, established by RFC 821 and renewed by this specification,
|
3191
|
+
is a registry of link and protocol identifiers to be used with the
|
3192
|
+
"via" and "with" subclauses of the time stamp ("Received: header")
|
3193
|
+
|
3194
|
+
described in section 4.4. Link and protocol identifiers in addition
|
3195
|
+
to those specified in this document may be registered only by
|
3196
|
+
standardization or by way of an RFC-documented, IESG-approved,
|
3197
|
+
Experimental protocol extension.
|
3198
|
+
|
3199
|
+
9. References
|
3200
|
+
|
3201
|
+
[1] American National Standards Institute (formerly United States of
|
3202
|
+
America Standards Institute), X3.4, 1968, "USA Code for
|
3203
|
+
Information Interchange". ANSI X3.4-1968 has been replaced by
|
3204
|
+
newer versions with slight modifications, but the 1968 version
|
3205
|
+
remains definitive for the Internet.
|
3206
|
+
|
3207
|
+
[2] Braden, R., "Requirements for Internet hosts - application and
|
3208
|
+
support", STD 3, RFC 1123, October 1989.
|
3209
|
+
|
3210
|
+
[3] Butler, M., Chase, D., Goldberger, J., Postel, J. and J.
|
3211
|
+
Reynolds, "Post Office Protocol - version 2", RFC 937, February
|
3212
|
+
1985.
|
3213
|
+
|
3214
|
+
[4] Callas, J., Donnerhacke, L., Finney, H. and R. Thayer, "OpenPGP
|
3215
|
+
Message Format", RFC 2440, November 1998.
|
3216
|
+
|
3217
|
+
[5] Crispin, M., "Interactive Mail Access Protocol - Version 2", RFC
|
3218
|
+
1176, August 1990.
|
3219
|
+
|
3220
|
+
[6] Crispin, M., "Internet Message Access Protocol - Version 4", RFC
|
3221
|
+
2060, December 1996.
|
3222
|
+
|
3223
|
+
[7] Crocker, D., "Standard for the Format of ARPA Internet Text
|
3224
|
+
Messages", RFC 822, August 1982.
|
3225
|
+
|
3226
|
+
[8] Crocker, D. and P. Overell, Eds., "Augmented BNF for Syntax
|
3227
|
+
Specifications: ABNF", RFC 2234, November 1997.
|
3228
|
+
|
3229
|
+
[9] De Winter, J., "SMTP Service Extension for Remote Message Queue
|
3230
|
+
Starting", RFC 1985, August 1996.
|
3231
|
+
|
3232
|
+
[10] Fajman, R., "An Extensible Message Format for Message
|
3233
|
+
Disposition Notifications", RFC 2298, March 1998.
|
3234
|
+
|
3235
|
+
[11] Freed, N, "Behavior of and Requirements for Internet Firewalls",
|
3236
|
+
RFC 2979, October 2000.
|
3237
|
+
|
3238
|
+
[12] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
|
3239
|
+
Extensions (MIME) Part One: Format of Internet Message Bodies",
|
3240
|
+
RFC 2045, December 1996.
|
3241
|
+
|
3242
|
+
[13] Freed, N., "SMTP Service Extension for Command Pipelining", RFC
|
3243
|
+
2920, September 2000.
|
3244
|
+
|
3245
|
+
[14] Galvin, J., Murphy, S., Crocker, S. and N. Freed, "Security
|
3246
|
+
Multiparts for MIME: Multipart/Signed and Multipart/Encrypted",
|
3247
|
+
RFC 1847, October 1995.
|
3248
|
+
|
3249
|
+
[15] Gellens, R. and J. Klensin, "Message Submission", RFC 2476,
|
3250
|
+
December 1998.
|
3251
|
+
|
3252
|
+
[16] Kille, S., "Mapping between X.400 and RFC822/MIME", RFC 2156,
|
3253
|
+
January 1998.
|
3254
|
+
|
3255
|
+
[17] Hinden, R and S. Deering, Eds. "IP Version 6 Addressing
|
3256
|
+
Architecture", RFC 2373, July 1998.
|
3257
|
+
|
3258
|
+
[18] Klensin, J., Freed, N. and K. Moore, "SMTP Service Extension for
|
3259
|
+
Message Size Declaration", STD 10, RFC 1870, November 1995.
|
3260
|
+
|
3261
|
+
[19] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker,
|
3262
|
+
"SMTP Service Extensions", STD 10, RFC 1869, November 1995.
|
3263
|
+
|
3264
|
+
[20] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker,
|
3265
|
+
"SMTP Service Extension for 8bit-MIMEtransport", RFC 1652, July
|
3266
|
+
1994.
|
3267
|
+
|
3268
|
+
[21] Lambert, M., "PCMAIL: A distributed mail system for personal
|
3269
|
+
computers", RFC 1056, July 1988.
|
3270
|
+
|
3271
|
+
[22] Mockapetris, P., "Domain names - implementation and
|
3272
|
+
specification", STD 13, RFC 1035, November 1987.
|
3273
|
+
|
3274
|
+
Mockapetris, P., "Domain names - concepts and facilities", STD
|
3275
|
+
13, RFC 1034, November 1987.
|
3276
|
+
|
3277
|
+
[23] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part
|
3278
|
+
Three: Message Header Extensions for Non-ASCII Text", RFC 2047,
|
3279
|
+
December 1996.
|
3280
|
+
|
3281
|
+
[24] Moore, K., "SMTP Service Extension for Delivery Status
|
3282
|
+
Notifications", RFC 1891, January 1996.
|
3283
|
+
|
3284
|
+
[25] Moore, K., and G. Vaudreuil, "An Extensible Message Format for
|
3285
|
+
Delivery Status Notifications", RFC 1894, January 1996.
|
3286
|
+
|
3287
|
+
[26] Myers, J. and M. Rose, "Post Office Protocol - Version 3", STD
|
3288
|
+
53, RFC 1939, May 1996.
|
3289
|
+
|
3290
|
+
[27] Partridge, C., "Mail routing and the domain system", RFC 974,
|
3291
|
+
January 1986.
|
3292
|
+
|
3293
|
+
[28] Partridge, C., "Duplicate messages and SMTP", RFC 1047, February
|
3294
|
+
1988.
|
3295
|
+
|
3296
|
+
[29] Postel, J., ed., "Transmission Control Protocol - DARPA Internet
|
3297
|
+
Program Protocol Specification", STD 7, RFC 793, September 1981.
|
3298
|
+
|
3299
|
+
[30] Postel, J., "Simple Mail Transfer Protocol", RFC 821, August
|
3300
|
+
1982.
|
3301
|
+
|
3302
|
+
[31] Ramsdell, B., Ed., "S/MIME Version 3 Message Specification", RFC
|
3303
|
+
2633, June 1999.
|
3304
|
+
|
3305
|
+
[32] Resnick, P., Ed., "Internet Message Format", RFC 2822, April
|
3306
|
+
2001.
|
3307
|
+
|
3308
|
+
[33] Vaudreuil, G., "SMTP Service Extensions for Transmission of
|
3309
|
+
Large and Binary MIME Messages", RFC 1830, August 1995.
|
3310
|
+
|
3311
|
+
[34] Vaudreuil, G., "Enhanced Mail System Status Codes", RFC 1893,
|
3312
|
+
January 1996.
|
3313
|
+
|
3314
|
+
10. Editor's Address
|
3315
|
+
|
3316
|
+
John C. Klensin
|
3317
|
+
AT&T Laboratories
|
3318
|
+
99 Bedford St
|
3319
|
+
Boston, MA 02111 USA
|
3320
|
+
|
3321
|
+
Phone: 617-574-3076
|
3322
|
+
EMail: klensin@research.att.com
|
3323
|
+
|
3324
|
+
11. Acknowledgments
|
3325
|
+
|
3326
|
+
Many people worked long and hard on the many iterations of this
|
3327
|
+
document. There was wide-ranging debate in the IETF DRUMS Working
|
3328
|
+
Group, both on its mailing list and in face to face discussions,
|
3329
|
+
about many technical issues and the role of a revised standard for
|
3330
|
+
Internet mail transport, and many contributors helped form the
|
3331
|
+
wording in this specification. The hundreds of participants in the
|
3332
|
+
many discussions since RFC 821 was produced are too numerous to
|
3333
|
+
mention, but they all helped this document become what it is.
|
3334
|
+
|
3335
|
+
APPENDICES
|
3336
|
+
|
3337
|
+
A. TCP Transport Service
|
3338
|
+
|
3339
|
+
The TCP connection supports the transmission of 8-bit bytes. The
|
3340
|
+
SMTP data is 7-bit ASCII characters. Each character is transmitted
|
3341
|
+
as an 8-bit byte with the high-order bit cleared to zero. Service
|
3342
|
+
extensions may modify this rule to permit transmission of full 8-bit
|
3343
|
+
data bytes as part of the message body, but not in SMTP commands or
|
3344
|
+
responses.
|
3345
|
+
|
3346
|
+
B. Generating SMTP Commands from RFC 822 Headers
|
3347
|
+
|
3348
|
+
Some systems use RFC 822 headers (only) in a mail submission
|
3349
|
+
protocol, or otherwise generate SMTP commands from RFC 822 headers
|
3350
|
+
when such a message is handed to an MTA from a UA. While the MTA-UA
|
3351
|
+
protocol is a private matter, not covered by any Internet Standard,
|
3352
|
+
there are problems with this approach. For example, there have been
|
3353
|
+
repeated problems with proper handling of "bcc" copies and
|
3354
|
+
redistribution lists when information that conceptually belongs to a
|
3355
|
+
mail envelopes is not separated early in processing from header
|
3356
|
+
information (and kept separate).
|
3357
|
+
|
3358
|
+
It is recommended that the UA provide its initial ("submission
|
3359
|
+
client") MTA with an envelope separate from the message itself.
|
3360
|
+
However, if the envelope is not supplied, SMTP commands SHOULD be
|
3361
|
+
generated as follows:
|
3362
|
+
|
3363
|
+
1. Each recipient address from a TO, CC, or BCC header field SHOULD
|
3364
|
+
be copied to a RCPT command (generating multiple message copies if
|
3365
|
+
that is required for queuing or delivery). This includes any
|
3366
|
+
addresses listed in a RFC 822 "group". Any BCC fields SHOULD then
|
3367
|
+
be removed from the headers. Once this process is completed, the
|
3368
|
+
remaining headers SHOULD be checked to verify that at least one
|
3369
|
+
To:, Cc:, or Bcc: header remains. If none do, then a bcc: header
|
3370
|
+
with no additional information SHOULD be inserted as specified in
|
3371
|
+
[32].
|
3372
|
+
|
3373
|
+
2. The return address in the MAIL command SHOULD, if possible, be
|
3374
|
+
derived from the system's identity for the submitting (local)
|
3375
|
+
user, and the "From:" header field otherwise. If there is a
|
3376
|
+
system identity available, it SHOULD also be copied to the Sender
|
3377
|
+
header field if it is different from the address in the From
|
3378
|
+
header field. (Any Sender field that was already there SHOULD be
|
3379
|
+
removed.) Systems may provide a way for submitters to override
|
3380
|
+
the envelope return address, but may want to restrict its use to
|
3381
|
+
privileged users. This will not prevent mail forgery, but may
|
3382
|
+
lessen its incidence; see section 7.1.
|
3383
|
+
|
3384
|
+
When an MTA is being used in this way, it bears responsibility for
|
3385
|
+
ensuring that the message being transmitted is valid. The mechanisms
|
3386
|
+
for checking that validity, and for handling (or returning) messages
|
3387
|
+
that are not valid at the time of arrival, are part of the MUA-MTA
|
3388
|
+
interface and not covered by this specification.
|
3389
|
+
|
3390
|
+
A submission protocol based on Standard RFC 822 information alone
|
3391
|
+
MUST NOT be used to gateway a message from a foreign (non-SMTP) mail
|
3392
|
+
system into an SMTP environment. Additional information to construct
|
3393
|
+
an envelope must come from some source in the other environment,
|
3394
|
+
whether supplemental headers or the foreign system's envelope.
|
3395
|
+
|
3396
|
+
Attempts to gateway messages using only their header "to" and "cc"
|
3397
|
+
fields have repeatedly caused mail loops and other behavior adverse
|
3398
|
+
to the proper functioning of the Internet mail environment. These
|
3399
|
+
problems have been especially common when the message originates from
|
3400
|
+
an Internet mailing list and is distributed into the foreign
|
3401
|
+
environment using envelope information. When these messages are then
|
3402
|
+
processed by a header-only remailer, loops back to the Internet
|
3403
|
+
environment (and the mailing list) are almost inevitable.
|
3404
|
+
|
3405
|
+
C. Source Routes
|
3406
|
+
|
3407
|
+
Historically, the <reverse-path> was a reverse source routing list of
|
3408
|
+
hosts and a source mailbox. The first host in the <reverse-path>
|
3409
|
+
SHOULD be the host sending the MAIL command. Similarly, the
|
3410
|
+
<forward-path> may be a source routing lists of hosts and a
|
3411
|
+
destination mailbox. However, in general, the <forward-path> SHOULD
|
3412
|
+
contain only a mailbox and domain name, relying on the domain name
|
3413
|
+
system to supply routing information if required. The use of source
|
3414
|
+
routes is deprecated; while servers MUST be prepared to receive and
|
3415
|
+
handle them as discussed in section 3.3 and F.2, clients SHOULD NOT
|
3416
|
+
transmit them and this section was included only to provide context.
|
3417
|
+
|
3418
|
+
For relay purposes, the forward-path may be a source route of the
|
3419
|
+
form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE MUST BE fully-
|
3420
|
+
qualified domain names. This form is used to emphasize the
|
3421
|
+
distinction between an address and a route. The mailbox is an
|
3422
|
+
absolute address, and the route is information about how to get
|
3423
|
+
there. The two concepts should not be confused.
|
3424
|
+
|
3425
|
+
If source routes are used, RFC 821 and the text below should be
|
3426
|
+
consulted for the mechanisms for constructing and updating the
|
3427
|
+
forward- and reverse-paths.
|
3428
|
+
|
3429
|
+
The SMTP server transforms the command arguments by moving its own
|
3430
|
+
identifier (its domain name or that of any domain for which it is
|
3431
|
+
acting as a mail exchanger), if it appears, from the forward-path to
|
3432
|
+
the beginning of the reverse-path.
|
3433
|
+
|
3434
|
+
Notice that the forward-path and reverse-path appear in the SMTP
|
3435
|
+
commands and replies, but not necessarily in the message. That is,
|
3436
|
+
there is no need for these paths and especially this syntax to appear
|
3437
|
+
in the "To:" , "From:", "CC:", etc. fields of the message header.
|
3438
|
+
Conversely, SMTP servers MUST NOT derive final message delivery
|
3439
|
+
information from message header fields.
|
3440
|
+
|
3441
|
+
When the list of hosts is present, it is a "reverse" source route and
|
3442
|
+
indicates that the mail was relayed through each host on the list
|
3443
|
+
(the first host in the list was the most recent relay). This list is
|
3444
|
+
used as a source route to return non-delivery notices to the sender.
|
3445
|
+
As each relay host adds itself to the beginning of the list, it MUST
|
3446
|
+
use its name as known in the transport environment to which it is
|
3447
|
+
relaying the mail rather than that of the transport environment from
|
3448
|
+
which the mail came (if they are different).
|
3449
|
+
|
3450
|
+
D. Scenarios
|
3451
|
+
|
3452
|
+
This section presents complete scenarios of several types of SMTP
|
3453
|
+
sessions. In the examples, "C:" indicates what is said by the SMTP
|
3454
|
+
client, and "S:" indicates what is said by the SMTP server.
|
3455
|
+
|
3456
|
+
D.1 A Typical SMTP Transaction Scenario
|
3457
|
+
|
3458
|
+
This SMTP example shows mail sent by Smith at host bar.com, to Jones,
|
3459
|
+
Green, and Brown at host foo.com. Here we assume that host bar.com
|
3460
|
+
contacts host foo.com directly. The mail is accepted for Jones and
|
3461
|
+
Brown. Green does not have a mailbox at host foo.com.
|
3462
|
+
|
3463
|
+
S: 220 foo.com Simple Mail Transfer Service Ready
|
3464
|
+
C: EHLO bar.com
|
3465
|
+
S: 250-foo.com greets bar.com
|
3466
|
+
S: 250-8BITMIME
|
3467
|
+
S: 250-SIZE
|
3468
|
+
S: 250-DSN
|
3469
|
+
S: 250 HELP
|
3470
|
+
C: MAIL FROM:<Smith@bar.com>
|
3471
|
+
S: 250 OK
|
3472
|
+
C: RCPT TO:<Jones@foo.com>
|
3473
|
+
S: 250 OK
|
3474
|
+
C: RCPT TO:<Green@foo.com>
|
3475
|
+
S: 550 No such user here
|
3476
|
+
C: RCPT TO:<Brown@foo.com>
|
3477
|
+
|
3478
|
+
S: 250 OK
|
3479
|
+
C: DATA
|
3480
|
+
S: 354 Start mail input; end with <CRLF>.<CRLF>
|
3481
|
+
C: Blah blah blah...
|
3482
|
+
C: ...etc. etc. etc.
|
3483
|
+
C: .
|
3484
|
+
S: 250 OK
|
3485
|
+
C: QUIT
|
3486
|
+
S: 221 foo.com Service closing transmission channel
|
3487
|
+
|
3488
|
+
D.2 Aborted SMTP Transaction Scenario
|
3489
|
+
|
3490
|
+
S: 220 foo.com Simple Mail Transfer Service Ready
|
3491
|
+
C: EHLO bar.com
|
3492
|
+
S: 250-foo.com greets bar.com
|
3493
|
+
S: 250-8BITMIME
|
3494
|
+
S: 250-SIZE
|
3495
|
+
S: 250-DSN
|
3496
|
+
S: 250 HELP
|
3497
|
+
C: MAIL FROM:<Smith@bar.com>
|
3498
|
+
S: 250 OK
|
3499
|
+
C: RCPT TO:<Jones@foo.com>
|
3500
|
+
S: 250 OK
|
3501
|
+
C: RCPT TO:<Green@foo.com>
|
3502
|
+
S: 550 No such user here
|
3503
|
+
C: RSET
|
3504
|
+
S: 250 OK
|
3505
|
+
C: QUIT
|
3506
|
+
S: 221 foo.com Service closing transmission channel
|
3507
|
+
|
3508
|
+
D.3 Relayed Mail Scenario
|
3509
|
+
|
3510
|
+
Step 1 -- Source Host to Relay Host
|
3511
|
+
|
3512
|
+
S: 220 foo.com Simple Mail Transfer Service Ready
|
3513
|
+
C: EHLO bar.com
|
3514
|
+
S: 250-foo.com greets bar.com
|
3515
|
+
S: 250-8BITMIME
|
3516
|
+
S: 250-SIZE
|
3517
|
+
S: 250-DSN
|
3518
|
+
S: 250 HELP
|
3519
|
+
C: MAIL FROM:<JQP@bar.com>
|
3520
|
+
S: 250 OK
|
3521
|
+
C: RCPT TO:<@foo.com:Jones@XYZ.COM>
|
3522
|
+
S: 250 OK
|
3523
|
+
C: DATA
|
3524
|
+
S: 354 Start mail input; end with <CRLF>.<CRLF>
|
3525
|
+
C: Date: Thu, 21 May 1998 05:33:29 -0700
|
3526
|
+
|
3527
|
+
C: From: John Q. Public <JQP@bar.com>
|
3528
|
+
C: Subject: The Next Meeting of the Board
|
3529
|
+
C: To: Jones@xyz.com
|
3530
|
+
C:
|
3531
|
+
C: Bill:
|
3532
|
+
C: The next meeting of the board of directors will be
|
3533
|
+
C: on Tuesday.
|
3534
|
+
C: John.
|
3535
|
+
C: .
|
3536
|
+
S: 250 OK
|
3537
|
+
C: QUIT
|
3538
|
+
S: 221 foo.com Service closing transmission channel
|
3539
|
+
|
3540
|
+
Step 2 -- Relay Host to Destination Host
|
3541
|
+
|
3542
|
+
S: 220 xyz.com Simple Mail Transfer Service Ready
|
3543
|
+
C: EHLO foo.com
|
3544
|
+
S: 250 xyz.com is on the air
|
3545
|
+
C: MAIL FROM:<@foo.com:JQP@bar.com>
|
3546
|
+
S: 250 OK
|
3547
|
+
C: RCPT TO:<Jones@XYZ.COM>
|
3548
|
+
S: 250 OK
|
3549
|
+
C: DATA
|
3550
|
+
S: 354 Start mail input; end with <CRLF>.<CRLF>
|
3551
|
+
C: Received: from bar.com by foo.com ; Thu, 21 May 1998
|
3552
|
+
C: 05:33:29 -0700
|
3553
|
+
C: Date: Thu, 21 May 1998 05:33:22 -0700
|
3554
|
+
C: From: John Q. Public <JQP@bar.com>
|
3555
|
+
C: Subject: The Next Meeting of the Board
|
3556
|
+
C: To: Jones@xyz.com
|
3557
|
+
C:
|
3558
|
+
C: Bill:
|
3559
|
+
C: The next meeting of the board of directors will be
|
3560
|
+
C: on Tuesday.
|
3561
|
+
C: John.
|
3562
|
+
C: .
|
3563
|
+
S: 250 OK
|
3564
|
+
C: QUIT
|
3565
|
+
S: 221 foo.com Service closing transmission channel
|
3566
|
+
|
3567
|
+
D.4 Verifying and Sending Scenario
|
3568
|
+
|
3569
|
+
S: 220 foo.com Simple Mail Transfer Service Ready
|
3570
|
+
C: EHLO bar.com
|
3571
|
+
S: 250-foo.com greets bar.com
|
3572
|
+
S: 250-8BITMIME
|
3573
|
+
S: 250-SIZE
|
3574
|
+
S: 250-DSN
|
3575
|
+
|
3576
|
+
S: 250-VRFY
|
3577
|
+
S: 250 HELP
|
3578
|
+
C: VRFY Crispin
|
3579
|
+
S: 250 Mark Crispin <Admin.MRC@foo.com>
|
3580
|
+
C: SEND FROM:<EAK@bar.com>
|
3581
|
+
S: 250 OK
|
3582
|
+
C: RCPT TO:<Admin.MRC@foo.com>
|
3583
|
+
S: 250 OK
|
3584
|
+
C: DATA
|
3585
|
+
S: 354 Start mail input; end with <CRLF>.<CRLF>
|
3586
|
+
C: Blah blah blah...
|
3587
|
+
C: ...etc. etc. etc.
|
3588
|
+
C: .
|
3589
|
+
S: 250 OK
|
3590
|
+
C: QUIT
|
3591
|
+
S: 221 foo.com Service closing transmission channel
|
3592
|
+
|
3593
|
+
E. Other Gateway Issues
|
3594
|
+
|
3595
|
+
In general, gateways between the Internet and other mail systems
|
3596
|
+
SHOULD attempt to preserve any layering semantics across the
|
3597
|
+
boundaries between the two mail systems involved. Gateway-
|
3598
|
+
translation approaches that attempt to take shortcuts by mapping,
|
3599
|
+
(such as envelope information from one system to the message headers
|
3600
|
+
or body of another) have generally proven to be inadequate in
|
3601
|
+
important ways. Systems translating between environments that do not
|
3602
|
+
support both envelopes and headers and Internet mail must be written
|
3603
|
+
with the understanding that some information loss is almost
|
3604
|
+
inevitable.
|
3605
|
+
|
3606
|
+
F. Deprecated Features of RFC 821
|
3607
|
+
|
3608
|
+
A few features of RFC 821 have proven to be problematic and SHOULD
|
3609
|
+
NOT be used in Internet mail.
|
3610
|
+
|
3611
|
+
F.1 TURN
|
3612
|
+
|
3613
|
+
This command, described in RFC 821, raises important security issues
|
3614
|
+
since, in the absence of strong authentication of the host requesting
|
3615
|
+
that the client and server switch roles, it can easily be used to
|
3616
|
+
divert mail from its correct destination. Its use is deprecated;
|
3617
|
+
SMTP systems SHOULD NOT use it unless the server can authenticate the
|
3618
|
+
client.
|
3619
|
+
|
3620
|
+
F.2 Source Routing
|
3621
|
+
|
3622
|
+
RFC 821 utilized the concept of explicit source routing to get mail
|
3623
|
+
from one host to another via a series of relays. The requirement to
|
3624
|
+
utilize source routes in regular mail traffic was eliminated by the
|
3625
|
+
introduction of the domain name system "MX" record and the last
|
3626
|
+
significant justification for them was eliminated by the
|
3627
|
+
introduction, in RFC 1123, of a clear requirement that addresses
|
3628
|
+
following an "@" must all be fully-qualified domain names.
|
3629
|
+
Consequently, the only remaining justifications for the use of source
|
3630
|
+
routes are support for very old SMTP clients or MUAs and in mail
|
3631
|
+
system debugging. They can, however, still be useful in the latter
|
3632
|
+
circumstance and for routing mail around serious, but temporary,
|
3633
|
+
problems such as problems with the relevant DNS records.
|
3634
|
+
|
3635
|
+
SMTP servers MUST continue to accept source route syntax as specified
|
3636
|
+
in the main body of this document and in RFC 1123. They MAY, if
|
3637
|
+
necessary, ignore the routes and utilize only the target domain in
|
3638
|
+
the address. If they do utilize the source route, the message MUST
|
3639
|
+
be sent to the first domain shown in the address. In particular, a
|
3640
|
+
server MUST NOT guess at shortcuts within the source route.
|
3641
|
+
|
3642
|
+
Clients SHOULD NOT utilize explicit source routing except under
|
3643
|
+
unusual circumstances, such as debugging or potentially relaying
|
3644
|
+
around firewall or mail system configuration errors.
|
3645
|
+
|
3646
|
+
F.3 HELO
|
3647
|
+
|
3648
|
+
As discussed in sections 3.1 and 4.1.1, EHLO is strongly preferred to
|
3649
|
+
HELO when the server will accept the former. Servers must continue
|
3650
|
+
to accept and process HELO in order to support older clients.
|
3651
|
+
|
3652
|
+
F.4 #-literals
|
3653
|
+
|
3654
|
+
RFC 821 provided for specifying an Internet address as a decimal
|
3655
|
+
integer host number prefixed by a pound sign, "#". In practice, that
|
3656
|
+
form has been obsolete since the introduction of TCP/IP. It is
|
3657
|
+
deprecated and MUST NOT be used.
|
3658
|
+
|
3659
|
+
F.5 Dates and Years
|
3660
|
+
|
3661
|
+
When dates are inserted into messages by SMTP clients or servers
|
3662
|
+
(e.g., in trace fields), four-digit years MUST BE used. Two-digit
|
3663
|
+
years are deprecated; three-digit years were never permitted in the
|
3664
|
+
Internet mail system.
|
3665
|
+
|
3666
|
+
F.6 Sending versus Mailing
|
3667
|
+
|
3668
|
+
In addition to specifying a mechanism for delivering messages to
|
3669
|
+
user's mailboxes, RFC 821 provided additional, optional, commands to
|
3670
|
+
deliver messages directly to the user's terminal screen. These
|
3671
|
+
commands (SEND, SAML, SOML) were rarely implemented, and changes in
|
3672
|
+
workstation technology and the introduction of other protocols may
|
3673
|
+
have rendered them obsolete even where they are implemented.
|
3674
|
+
|
3675
|
+
Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers
|
3676
|
+
MAY implement them. If they are implemented by servers, the
|
3677
|
+
implementation model specified in RFC 821 MUST be used and the
|
3678
|
+
command names MUST be published in the response to the EHLO command.
|
3679
|
+
|
3680
|
+
Full Copyright Statement
|
3681
|
+
|
3682
|
+
Copyright (C) The Internet Society (2001). All Rights Reserved.
|
3683
|
+
|
3684
|
+
This document and translations of it may be copied and furnished to
|
3685
|
+
others, and derivative works that comment on or otherwise explain it
|
3686
|
+
or assist in its implementation may be prepared, copied, published
|
3687
|
+
and distributed, in whole or in part, without restriction of any
|
3688
|
+
kind, provided that the above copyright notice and this paragraph are
|
3689
|
+
included on all such copies and derivative works. However, this
|
3690
|
+
document itself may not be modified in any way, such as by removing
|
3691
|
+
the copyright notice or references to the Internet Society or other
|
3692
|
+
Internet organizations, except as needed for the purpose of
|
3693
|
+
developing Internet standards in which case the procedures for
|
3694
|
+
copyrights defined in the Internet Standards process must be
|
3695
|
+
followed, or as required to translate it into languages other than
|
3696
|
+
English.
|
3697
|
+
|
3698
|
+
The limited permissions granted above are perpetual and will not be
|
3699
|
+
revoked by the Internet Society or its successors or assigns.
|
3700
|
+
|
3701
|
+
This document and the information contained herein is provided on an
|
3702
|
+
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
3703
|
+
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
3704
|
+
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
3705
|
+
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
3706
|
+
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
3707
|
+
|
3708
|
+
Acknowledgement
|
3709
|
+
|
3710
|
+
Funding for the RFC Editor function is currently provided by the
|
3711
|
+
Internet Society.
|