> For the complete documentation index, see [llms.txt](https://docs.sikka.io/vps-workbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sikka.io/vps-workbook/setup-mailserver.md).

# Setup Mailserver

1. Create the website for the domain you want to make emails for
2. Enable SSL
3. Generate a DKIM key in <https://c01.sikka.io/email/dkimManager>
4. Create the first email for the domain (for example <admin@example.com>)
5. Run the following command to findout the ipv4 of your linux server

```
ip -6 addr
```

6. Add the global ipv4 to the spf record and update it in the DNS records as follows: (change the IP address to your server's)

```
v=spf1 a mx ip6:2402:1f00:8000:800::2d43 ip4:51.79.248.76 ~all
```

7. You might have to create a mailserver SSL in cyberpanel
8. When adding the DKIM records to the DNS, make sure there are no qoutes and that the p= is one line

## DNS Records

<table><thead><tr><th>Type</th><th width="220">Name</th><th width="228">Value</th><th>Priority</th></tr></thead><tbody><tr><td>A</td><td>mail</td><td>IP</td><td>n/a</td></tr><tr><td>A</td><td>@</td><td>IP</td><td>n/a</td></tr><tr><td>A</td><td>www</td><td>IP</td><td>n/a</td></tr><tr><td>MX</td><td>@</td><td>mail.example.com</td><td>10</td></tr><tr><td>TXT</td><td>default._domainkey</td><td></td><td></td></tr><tr><td>TXT</td><td>_dmarc</td><td></td><td></td></tr><tr><td>TXT</td><td>_domainkey</td><td>t=y; o=~;</td><td></td></tr><tr><td>TXT</td><td>@</td><td>v=spf1 ip6:IP6_ADDRESS ip4:IP4_ADDRESS ~all</td><td></td></tr></tbody></table>
