Postfix is a popular mail client, both because of its security and lightweight nature, and for its ease of use. Though Postfix 2.2 and greater support IPv6 out-of-the-box, it is not enabled by default, but can easily be enabled with a few configuration tweaks. It is assumed you already have IPv6 connectivity — if you don't, follow the 10 easy steps to IPv6.
We will assume your mail server has an IPv6 address of 2001:db8::1234, and has a hostname of cheshire.
$ ifconfig eth0 | grep inet6 inet6 addr: 2001:db8::1234/64 Scope:Global inet6 addr: fe80::1234/64 Scope:Link
You should have an MX record on the domain you want to receive mail on, pointing to your server:
$ host -t mx example.com example.com mail is handled by 10 cheshire.example.com.
If you already have working IPv4 mail on this Postfix server, cheshire.example.com will probably already have an A record to your server, e.g. 192.0.2.28. However, it is important that you add an AAAA record that points to your server's IPv6 address, e.g.:
$ host cheshire.example.com cheshire.example.com has address 192.0.2.28 cheshire.example.com has IPv6 address 2001:db8::1234
If this mail server does not use an upstream mail server (configuration option "relayhost" for Postfix), then you will need to make sure the server has reverse DNS associated. Setting that up is left as an exercise to the reader.
Unfortunately, by default, Postfix assumes you only want to accept IPv4 mail. So if you haven't explicitly enabled it, Postfix assumes the following configuration:
inet_protocols = ipv4
Postfix accepts "ipv4", "ipv6", and "all" as parameters to this option. So if we want to accept IPv4 and IPv6 mail, we can specify:
inet_protocols = all
Similar, but still separate, is the inet_interfaces directive. While inet_protocols tells Postfix whether to use IPv4 or IPv6, inet_interfaces tells Postfix what interfaces to listen on, and if it is only told to listen on IPv4 interfaces, you will only be able to receive IPv4 mail, despite supporting the IPv6 protocol.
The default is to listen on all interfaces:
inet_interfaces = all
This is fine for accepting IPv4 and IPv6 mail, so if you have the above, or don't specify inet_interfaces, you're good to go. On the other hand, if you explicitly specify IP addresses in that directive (for more complex setups), you will need to make sure your IPv6 addresses are specified too.
For example, this example won't work with IPv6:
inet_interfaces = 127.0.0.1, 192.0.2.28
You will need to add your IPv6 interfaces:
inet_interfaces = 127.0.0.1, [::1], 192.0.2.28, [2001:db8::1234]
If you want users on your LAN to be able to send mail via your mail server (which is a good idea, as only being able to receive mail is a bit lonely), then you will need to make sure your IPv6 subnets are added to the mynetworks directive.
The mynetworks directive is sometimes problematic, and even if you set mynetworks_style = subnet, will sometimes only trust your IPv4 subnets, and will probably either look like the following, or if not specified, will still behave as thus:
mynetworks = 127.0.0.0/8 192.0.2.0/24
You may need to explicitly add your IPv6 subnets. It would also be a good idea to specify the IPv6 loopback address, ::1.
mynetworks = 127.0.0.0/8 192.0.2.0/24 [::1]/128 [2001:db8:0:0::]/64
If your organisation has a large IPv6 subnet (e.g. a /48 or a /56), make sure to specify it in the above, so that your entire organisation can send mail through your server, which is probably what you want.
Last, but not least, because IPv6 mail is geeky cool, I recommend you customise your smtpd_banner to something witty. Something like the following should do fine:
smtpd_banner = $myhostname says you should eat an apple a day to keep the doctor away.
Don't forget to restart your Postfix daemon, preferably with your initscript:
# /etc/init.d/postfix restart
Moment of truth
If everything is set up correctly, you should be ready to accept IPv6 mail. The best sanity check is to telnet into your mail server over port 25 (the SMTP port that Postfix listens on) to make sure it is accessible.
$ telnet 2001:db8::1234 25 Trying 2001:db8::1234... Connected to 2001:db8::1234. Escape character is '^]'. 220 cheshire says you should eat an apple a day to keep the doctor away.
You can use the "chatscript" from Wikipedia to deliver a mail by hand, or you can use the "mail" program from a second system:
$ mail email@example.com -s 'Hello World' The quick brown fox jumped over the lazy dogs. ^D CC:
Or you could just enter "cheshire.example.com" as the SMTP server of an IPv6-enabled MUA, such as GNOME Evolution, Mozilla Thunderbird, or Windows Mail.
You can pretend it is working all you like, but the moment of truth is when you can see mail coming in from IPv6 hosts in mail.log, like so:
postfix/smtpd: connect from madhatter.example.com[2001:db8::9876] postfix/smtpd: 02BEB1E12FC: client=madhatter.example.com[2001:db8::9876] postfix/cleanup: 02BEB1E12FC: message-id=<20100207222730.E0518204A8@madhatter.example.com> postfix/qmgr: 02BEB1E12FC: from=<firstname.lastname@example.org>, size=600, nrcpt=1 (queue active) postfix/smtpd: disconnect from madhatter.example.com[2001:db8::9876] postfix/qmgr: 02BEB1E12FC: removed postfix/local: 02BEB1E12FC: to=<email@example.com>, relay=local, delay=0.05, delays=0.04/0/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Your mail headers should also be tell-tale:
Received: from madhatter.example.com (madhatter.example.com [IPv6:2001:db8::9876]) by cheshire (Postfix) with ESMTP id 55FD61E12FC for <madhatter.example.com>; Mon, 8 Feb 2010 09:30:25 +1100 (EST) Received: by madhatter.example.com (Postfix, from userid 1000) id 3726C204A8; Mon, 8 Feb 2010 09:31:11 +1100 (EST) To: firstname.lastname@example.org
Postfix needs a little coaxing to get IPv6 working, but it is relatively easy to get going, and getting your first IPv6 mail is very rewarding. Accepting IPv6 mail from the Internet is going to become a requirement to do business after many mail servers no longer have IPv4 connectivity.