1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 4<html> 5 6<head> 7 8<title>Postfix SMTPUTF8 support</title> 9 10<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 11<link rel='stylesheet' type='text/css' href='postfix-doc.css'> 12 13</head> 14 15<body> 16 17<h1><img src="postfix-logo.jpg" width="203" height="98" ALT=""> 18Postfix SMTPUTF8 support 19</h1> 20 21<hr> 22 23<h2> Overview </h2> 24 25<p> This document describes Postfix support for Email Address 26Internationalization (EAI) as defined in RFC 6531 (SMTPUTF8 extension), 27RFC 6532 (Internationalized email headers) and RFC 6533 (Internationalized 28delivery status notifications). Introduced with Postfix version 293.0, this fully supports UTF-8 email addresses and UTF-8 message 30header values. </p> 31 32<p> Topics covered in this document: </p> 33 34<ul> 35 36<li><a href="#building">Building with/without SMTPUTF8 support</a> 37 38<li><a href="#enabling">Enabling Postfix SMTPUTF8 support</a> 39 40<li><a href="#using">Using Postfix SMTPUTF8 support</a> 41 42<li><a href="#detecting">SMTPUTF8 autodetection</a> 43 44<li><a href="#limitations">Limitations of the current implementation</a> 45 46<li><a href="#compatibility">Compatibility with pre-SMTPUTF8 environments</a> 47 48<li><a href="#idna2003">Compatibility with IDNA2003</a> 49 50<li><a href="#credits">Credits</a> 51 52</ul> 53 54<h2> <a name="building">Building Postfix with/without SMTPUTF8 support</a> </h2> 55 56<p> Postfix will build with SMTPUTF8 support if the ICU version 57≥ 46 library and header files are installed on the system. The 58package name varies with the OS distribution. The table shows package 59names for a number of platforms at the time this text was written. 60</p> 61 62<blockquote> 63 64<table border="1"> 65 66<tr> <th> OS Distribution </th> <th> Package </th> </tr> 67 68<tr> <td> FreeBSD, NetBSD, etc. </td> <td> icu </td> </tr> 69 70<tr> <td> Centos, Fedora, RHEL </td> <td> libicu-devel </td> </tr> 71 72<tr> <td> Debian, Ubuntu </td> <td> libicu-dev </td> </tr> 73 74</table> 75 76</blockquote> 77 78<p> To force Postfix to build without SMTPUTF8, specify: </p> 79 80<blockquote> 81<pre> 82$ <b>make makefiles CCARGS="-DNO_EAI ..."</b> 83</pre> 84</blockquote> 85 86<p> See the INSTALL document for more "make makefiles" options. </p> 87 88<h2> <a name="enabling">Enabling Postfix SMTPUTF8 support</a> </h2> 89 90<p> There is more to SMTPUTF8 than just Postfix itself. The rest 91of your email infrastructure also needs to be able to handle UTF-8 92email addresses and message header values. This includes SMTPUTF8 93protocol support in SMTP-based content filters (Amavisd), LMTP 94servers (Dovecot), and down-stream SMTP servers. </p> 95 96<p> Postfix SMTPUTF8 support is enabled by default, but it may be 97disabled as part of a backwards-compatibility safety net (see the 98COMPATIBILITY_README file). </p> 99 100<p> SMTPUTF8 support is enabled by setting the smtputf8_enable 101parameter in main.cf:</p> 102 103<blockquote> 104<pre> 105# <b>postconf "smtputf8_enable = yes"</b> 106# <b>postfix reload</b> 107</pre> 108</blockquote> 109 110<p> (With Postfix ≤ 3.1, you may also need to specify "<b>option_group 111= client</b>" in Postfix MySQL client files, to enable UTF8 support 112in MySQL queries. This setting is the default as of Postfix 3.2.) </p> 113 114<p> With SMTPUTF8 support enabled, Postfix changes behavior with 115respect to earlier Postfix releases: </p> 116 117<ul> 118 119<li> <p> UTF-8 is permitted in the myorigin parameter value. However, 120the myhostname and mydomain parameters must currently specify 121ASCII-only domain names. This limitation may be removed later. </p> 122 123<li> <p> UTF-8 is the only form of non-ASCII text that Postfix 124supports in access tables, address rewriting tables, and other 125tables that are indexed with an email address, hostname, or domain 126name. </p> 127 128<li> <p> The header_checks-like and body_checks-like features are 129not UTF-8 enabled, and therefore they do not enforce UTF-8 syntax 130rules on inputs and outputs. The reason is that non-ASCII text may 131be sent in encodings other than UTF-8, and that real email sometimes 132contains malformed headers. Instead of skipping non-UTF-8 content, 133Postfix should be able to filter it. You may try to enable UTF-8 134processing by starting a PCRE pattern with the sequence (*UTF8), 135but this is will result in "message not accepted, try again later" 136errors when the PCRE pattern matcher encounters non-UTF-8 input. 137Other features that are not UTF-8 enabled are smtpd_command_filter, 138smtp_reply_filter, the *_delivery_status_filter features, and the 139*_dns_reply_filter features (the latter because DNS is by definition 140an ASCII protocol). </p> 141 142<li> <p> The Postfix SMTP server announces SMTPUTF8 support in the 143EHLO response. </p> 144 145<pre> 146220 server.example.com ESMTP Postfix 147<b>EHLO client.example.com</b> 148250-server.example.com 149250-PIPELINING 150250-SIZE 10240000 151250-VRFY 152250-ETRN 153250-STARTTLS 154250-AUTH PLAIN LOGIN 155250-ENHANCEDSTATUSCODES 156250-8BITMIME 157250-DSN 158250 SMTPUTF8 159</pre> 160 161<li> <p> The Postfix SMTP server accepts the SMTPUTF8 request in 162MAIL FROM and VRFY commands. </p> 163 164<pre> 165<b>MAIL FROM:<address> SMTPUTF8 ...</b> 166 167<b>VRFY address SMTPUTF8</b> 168</pre> 169 170<li> <p> The Postfix SMTP client may issue the SMTPUTF8 request in 171MAIL FROM commands. </p> 172 173<li> <p> The Postfix SMTP server accepts UTF-8 in email address 174domains, but only after the remote SMTP client issues the 175SMTPUTF8 request in MAIL FROM or VRFY commands. </p> 176 177</ul> 178 179<p> Postfix already permitted UTF-8 in message header values 180and in address localparts. This does not change. </p> 181 182<h2> <a name="using">Using Postfix SMTPUTF8 support</a> </h2> 183 184<p> After Postfix SMTPUTF8 support is turned on, Postfix behavior 185will depend on 1) whether a remote SMTP client requests SMTPUTF8 186support, 2) the presence of UTF-8 content in the message envelope 187and headers, and 3) whether a down-stream SMTP (or LMTP) server 188announces SMTPUTF8 support. </p> 189 190<ul> 191 192<li> <p> When the Postfix SMTP server receives a message WITHOUT 193the SMTPUTF8 request, Postfix handles the message as it has always 194done (at least that is the default, see autodetection below). 195Specifically, the Postfix SMTP server does not accept UTF-8 in the 196envelope sender domain name or envelope recipient domain name, and 197the Postfix SMTP client does not issue the SMTPUTF8 request when 198delivering that message to an SMTP or LMTP server that announces 199SMTPUTF8 support (again, that is the default). Postfix will accept 200UTF-8 in message header values and in the localpart of envelope 201sender and recipient addresses, because it has always done that. 202</p> 203 204<li> <p> When the Postfix SMTP server receives a message WITH the 205SMTPUTF8 request, Postfix will issue the SMTPUTF8 request when 206delivering that message to an SMTP or LMTP server that announces 207SMTPUTF8 support. This is not configurable. </p> 208 209<li> <p> When a message is received with the SMTPUTF8 request, 210Postfix will deliver the message to a non-SMTPUTF8 SMTP or LMTP 211server ONLY if: </p> 212 213 <ul> 214 215 <li> <p> No message header value contains UTF-8. </p> 216 217 <li> <p> The envelope sender address contains no UTF-8, </p> 218 219 <li> <p> No envelope recipient address for that specific 220 SMTP/LMTP delivery transaction contains UTF-8. </p> 221 222 <blockquote> <p> NOTE: Recipients in other email delivery 223 transactions for that same message may still contain UTF-8. 224 </p> </blockquote> 225 226 </ul> 227 228 <p> Otherwise, Postfix will return the recipient(s) for that 229 email delivery transaction as undeliverable. The delivery status 230 notification message will be an SMTPUTF8 message. It will therefore 231 be subject to the same restrictions as email that is received 232 with the SMTPUTF8 request. </p> 233 234<li> <p> When the Postfix SMTP server receives a message with the 235SMTPUTF8 request, that request also applies after the message is 236forwarded via a virtual or local alias, or $HOME/.forward file. 237</p> 238 239</ul> 240 241<h2> <a name="detecting">SMTPUTF8 autodetection</a> </h2> 242 243<p> This section applies only to systems that have SMTPUTF8 support 244turned on (smtputf8_enable = yes). </p> 245 246<p> For compatibility with pre-SMTPUTF8 environments, Postfix does 247not automatically set the "SMTPUTF8 requested" flag on messages 248from non-SMTPUTF8 clients that contain a UTF-8 header value or 249UTF-8 address localpart. This would make such messages undeliverable 250to non-SMTPUTF8 servers, and could be a barrier to SMTPUTF8 adoption. 251</p> 252 253<p> By default, Postfix sets the "SMTPUTF8 requested" flag only on 254address verification probes and on Postfix sendmail submissions 255that contain UTF-8 in the sender address, UTF-8 in a recipient 256address, or UTF-8 in a message header value. </p> 257 258<blockquote> 259<pre> 260/etc/postfix/main.cf: 261 smtputf8_autodetect_classes = sendmail, verify 262</pre> 263</blockquote> 264 265<p> However, if you have a non-ASCII myorigin or mydomain setting, 266or if you have a configuration that introduces UTF-8 addresses with 267virtual aliases, canonical mappings, or BCC mappings, then you may 268have to apply SMTPUTF8 autodetection to all email: </p> 269 270<blockquote> 271<pre> 272/etc/postfix/main.cf: 273 smtputf8_autodetect_classes = all 274</pre> 275</blockquote> 276 277<p> This will, of course, also flag email that was received without 278SMTPUTF8 request, but that contains UTF-8 in a sender address 279localpart, receiver address localpart, or message header value. 280Such email was not standards-compliant, but Postfix would have 281delivered it if SMTPUTF8 support was disabled. </p> 282 283<h2> <a name="limitations">Limitations of the current implementation</a> 284</h2> 285 286<p> The Postfix implementation is a work in progress; limitations 287are steadily being removed. The text below describes the situation 288at one point in time. </p> 289 290<h3> No automatic conversions between ASCII and UTF-8 domain names. </h3> 291 292<p> Some background: According to RFC 6530 and related documents, 293an internationalized domain name can appear in two forms: the UTF-8 294form, and the ASCII (xn--mumble) form. An internationalized address 295localpart must be encoded in UTF-8; the RFCs do not define an ASCII 296alternative form. </p> 297 298<p> Postfix currently does not convert internationalized domain 299names from UTF-8 into ASCII (or from ASCII into UTF-8) before using 300domain names in SMTP commands and responses, before looking up 301domain names in lists such as mydestination, relay_domains or in 302lookup tables such as access tables, etc., before using domain names 303in a policy daemon or Milter request, or before logging events. 304</p> 305 306<p> Postfix does, however, casefold domain names and email addresses 307before matching them against a Postfix configuration parameter or 308lookup table. </p> 309 310<p> In order to use Postfix SMTPUTF8 support: </p> 311 312<ul> 313 314<li> <p> The Postfix parameters myhostname and mydomain must be in 315ASCII form. One is a substring of the other, and the myhostname 316value is used in SMTP commands and responses that require ASCII. 317The parameter myorigin (added to local addresses without domain) 318supports UTF-8. </p> 319 320<li> <p> You need to configure both the ASCII and UTF-8 forms of 321an Internationalized domain name in Postfix parameters such as 322mydestination and relay_domains, as well as lookup table search 323keys. </p> 324 325<li> <p> Milters, content filters, policy servers and logfile 326analysis tools need to be able to handle both the ASCII and UTF-8 327forms of Internationalized domain names. </p> 328 329</ul> 330 331<h2> <a name="compatibility">Compatibility with pre-SMTPUTF8 332environments</a> </h2> 333 334<h3> Mailing lists with UTF-8 and non-UTF-8 subscribers </h3> 335 336<p> With Postfix, there is no need to split mailing lists into UTF-8 and 337non-UTF-8 members. Postfix will try to deliver the non-UTF8 subscribers 338over "traditional" non-SMTPUTF8 sessions, as long as the message 339has an ASCII envelope sender address and all-ASCII header values. 340The mailing list manager may have to apply RFC 2047 encoding to 341satisfy that last condition. </p> 342 343<h3> Pre-existing non-ASCII email flows </h3> 344 345<p> With "smtputf8_enable = no", Postfix handles email with non-ASCII 346in address localparts (and in headers) as before. The vast majority 347of email software is perfectly capable of handling such email, even 348if pre-SMTPUTF8 standards do not support such practice. </p> 349 350<h3> Rejecting non-UTF8 addresses </h3> 351 352<p> With "smtputf8_enable = yes", Postfix 353requires that non-ASCII address information is encoded in UTF-8 and 354will reject other encodings such as ISO-8859. It is not practical 355for Postfix to support multiple encodings at the same time. There 356is no problem with RFC 2047 encodings such as "=?ISO-8859-1?Q?text?=", 357because those use only characters from the ASCII characterset. </p> 358 359<h3> Rejecting non-ASCII addresses in non-SMTPUTF8 transactions </h3> 360 361<p> Setting "strict_smtputf8 = yes" in addition to "smtputf8_enable 362= yes" will enable stricter enforcement of the SMTPUTF8 protocol. 363Specifically, the Postfix SMTP server will not only reject non-UTF8 364sender or recipient addresses, it will in addition accept UTF-8 365sender or recipient addresses only when the client requests an 366SMTPUTF8 mail transaction. </p> 367 368<h2> <a name="idna2003">Compatibility with IDNA2003</a> </h2> 369 370<p> Postfix ≥ 3.2 by default disables the 'transitional' 371compatibility between IDNA2003 and IDNA2008, when converting UTF-8 372domain names to/from the ASCII form that is used in DNS lookups. 373This makes Postfix behavior consistent with current versions of the 374Firefox and Chrome web browsers. Specify "enable_idna2003_compatibility 375= yes" to get the historical behavior. </p> 376 377<p> This affects the conversion of domain names that contain for 378example the German sz (ß) and the Greek zeta (ς). See 379http://unicode.org/cldr/utility/idna.jsp for more examples. </p> 380 381<h2> <a name="credits">Credits</a> </h2> 382 383<ul> 384 385<li> <p> May 15, 2014: Arnt Gulbrandsen posted his patch for Unicode 386email support. This work was sponsored by CNNIC. </p> 387 388<li> <p> July 15, 2014: Wietse integrated Arnt Gulbrandsen's code 389and released Postfix with SMTPUTF8 support. </p> 390 391<li> <p> January 2015: Wietse added UTF-8 support for casefolding 392in Postfix lookup tables and caseless string comparison in Postfix 393list-based features. </p> 394 395</ul> 396 397</body> 398 399</html> 400 401