Postfix on KPN Direct ADSL

Hi,

I had a lot of trouble setting up Postfix so that it would relay my mail (sending only). I am using KPN Direct ADSL and have documented some tricks here for Ubuntu 12.10.

KPN’s support answer is somewhat useful but not that much:
http://kpn-customer.custhelp.com/app/answers/detail/a_id/13372

The three different addresses they are mentioning for the relayhost, confused me a lot. The right relayhost to use is: mail.kpnmail.nl.

My /etc/postfix/main.cf looks like this:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = <hostname>
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = <externaldomain>, <hostname>, localhost
relayhost = [mail.kpnmail.nl]
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
default_transport = relay
relay_transport = relay
inet_protocols = all
sender_canonical_maps=hash:/etc/postfix/sender_canonical

Please make sure that you replace <hostname> and <externaldomain> with your machine’s hostname and external domain URL.

The last I found with http://www.whatismyip.com/ to get my external ip address and to get your external domain URL:

host <ip-address>

Notice that I had to change the default_transport and relay_transport to error to:

default_transport = relay
relay_transport = relay

The other thing I had to do is to set the following to change rewrite the from field as KPN does not accept the <user>@<hostname> that your Ubuntu machine provides:

sender_canonical_maps=hash:/etc/postfix/sender_canonical

To set up your sender_canonical file, follow these instructions:
http://ubuntuforums.org/archive/index.php/t-38429.html

Useful background information can be found here:
http://www.postfix.org/

Posted on December 17, 2012, in Linux, Quantal Quetzal, Technology, Tips and tricks, Troubleshooting, Ubuntu and tagged , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: