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