Postfix3.3.1
smtputf8.h
[詳解]
1 #ifndef _SMTPUTF8_H_INCLUDED_
2 #define _SMTPUTF8_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* smtputf8 3h
7 /* SUMMARY
8 /* SMTPUTF8 support
9 /* SYNOPSIS
10 /* #include <smtputf8.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15  * Avoiding chicken-and-egg problems during the initial SMTPUTF8 roll-out in
16  * environments with pre-existing mail flows that contain UTF8.
17  *
18  * Prior to SMTPUTF8, mail flows that contain UTF8 worked because the vast
19  * majority of MTAs is perfectly capable of handling UTF8 in address
20  * localparts (and in headers), even if pre-SMTPUTF8 standards do not
21  * support this practice.
22  *
23  * When turning on Postfix SMTPUTF8 support for the first time, we don't want
24  * to suddenly break pre-existing mail flows that contain UTF8 because 1) a
25  * client does not request SMTPUTF8 support, and because 2) a down-stream
26  * MTA does not announce SMTPUTF8 support.
27  *
28  * While 1) is easy enough to avoid (keep accepting UTF8 in address localparts
29  * just like Postfix has always done), 2) presents a thornier problem. The
30  * root cause of that problem is the need for SMTPUTF8 autodetection.
31  *
32  * What is SMTPUTF8 autodetection? Postfix cannot rely solely on the sender's
33  * declaration that a message requires SMTPUTF8 support, because UTF8 may be
34  * introduced during local processing (for example, the client hostname in
35  * Postfix's Received: header, adding @$myorigin or .$mydomain to an
36  * incomplete address, address rewriting, alias expansion, automatic BCC
37  * recipients, local forwarding, and changes made by header checks or Milter
38  * applications).
39  *
40  * In summary, after local processing has happened, Postfix may decide that a
41  * message requires SMTPUTF8 support, even when that message initially did
42  * not require SMTPUTF8 support. This could make the message undeliverable
43  * to destinations that do not support SMTPUTF8. In an environment with
44  * pre-existing mail flows that contain UTF8, we want to avoid disrupting
45  * those mail flows when rolling out SMTPUTF8 support.
46  *
47  * For the vast majority of sites, the simplest solution is to autodetect
48  * SMTPUTF8 support only for Postfix sendmail command-line submissions, at
49  * least as long as SMTPUTF8 support has not yet achieved wold domination.
50  *
51  * However, sites that add UTF8 content via local processing (see above) should
52  * autodetect SMTPUTF8 support for all email.
53  *
54  * smtputf8_autodetect() uses the setting of the smtputf8_autodetect_classes
55  * parameter, and the mail source classes defined in mail_params.h.
56  */
57 extern int smtputf8_autodetect(int);
58 
59  /*
60  * The flag SMTPUTF8_FLAG_REQUESTED is raised on request by the sender, or
61  * when a queue file contains at least one UTF8 envelope recipient. One this
62  * flag is raised it is preserved when mail is forwarded or bounced.
63  *
64  * The flag SMTPUTF8_FLAG_HEADER is raised when a queue file contains at least
65  * one UTF8 message header.
66  *
67  * The flag SMTPUTF8_FLAG_SENDER is raised when a queue file contains an UTF8
68  * envelope sender.
69  *
70  * The three flags SMTPUTF8_FLAG_REQUESTED/HEADER/SENDER are stored in the
71  * queue file, are sent with delivery requests to Postfix delivery agents,
72  * and are sent with "flush" requests to the bounce daemon to ensure that
73  * the resulting notification message will have a content-transfer-encoding
74  * of 8bit.
75  *
76  * In the future, mailing lists will have a mix of UTF8 and non-UTF8
77  * subscribers. With the following flag, Postfix can avoid requiring
78  * SMTPUTF8 delivery when it isn't really needed.
79  *
80  * The flag SMTPUTF8_FLAG_RECIPIENT is raised when a delivery request (NOT:
81  * message) contains at least one UTF8 envelope recipient. The flag is NOT
82  * stored in the queue file. The flag sent in requests to the bounce daemon
83  * ONLY when bouncing a single recipient. The flag is used ONLY in requests
84  * to Postfix delivery agents, to give Postfix flexibility when delivering
85  * messages to non-SMTPUTF8 servers.
86  *
87  * If a delivery request has none of the flags SMTPUTF8_FLAG_RECIPIENT,
88  * SMTPUTF8_FLAG_SENDER, or SMTPUTF8_FLAG_HEADER, then the message can
89  * safely be delivered to a non-SMTPUTF8 server (DSN original recipients
90  * will be encoded appropriately per RFC 6533).
91  *
92  * To allow even more SMTPUTF8 mail to be sent to non-SMTPUTF8 servers,
93  * implement RFC 2047 header encoding in the Postfix SMTP client, and update
94  * the SMTP client protocol engine.
95  */
96 #define SMTPUTF8_FLAG_NONE (0)
97 #define SMTPUTF8_FLAG_REQUESTED (1<<0) /* queue file/delivery/bounce request */
98 #define SMTPUTF8_FLAG_HEADER (1<<1) /* queue file/delivery/bounce request */
99 #define SMTPUTF8_FLAG_SENDER (1<<2) /* queue file/delivery/bounce request */
100 #define SMTPUTF8_FLAG_RECIPIENT (1<<3) /* delivery request only */
101 
102 /* LICENSE
103 /* .ad
104 /* .fi
105 /* The Secure Mailer license must be distributed with this software.
106 /* AUTHOR(S)
107 /* Wietse Venema
108 /* IBM T.J. Watson Research
109 /* P.O. Box 704
110 /* Yorktown Heights, NY 10598, USA
111 /*--*/
112 
113 #endif
int smtputf8_autodetect(int)
Definition: smtputf8.c:67