This guide uses Ubuntu.
Installing & configuring Postfix
Install Postfix:
$ sudo apt install postfix
When asked about the environment, select “Internet Site”. When asked to confirm the hostname, make sure it matches the inbound email domain you gave have configured in the Kantree configuration.
Now we will setup a catch-all alias that will redirect all emails from our domain to a curl command.
Add the following line to /etc/postfix/main.cf:
virtual_alias_maps = hash:/etc/postfix/redirect
Open /etc/postfix/redirect and add the following line:
@yourkantreeinbounddomain.com curl_email
Then build the db file using:
$ postmap /etc/postfix/redirect
(This needs to be done every time you edit the redirect file)
Now we will add a new alias in /etc/aliases. Add the following line:
curl_email: "|curl --data-binary @- http://yourkantreedomain.com/integrations/email/inbound"
Finally, update the alias table:
$ newaliases
Finally, restart postfix and try out your setup
Setup DNS records
Add an A record that points to the IP if the Postfix server.
Add an MX record with 10 yourkantreeinbounddomain.com