![]() |
|
Guide CyberPanel Email Setup: Mailbox, DKIM, SPF, DMARC (and a DKIM Signing Bug Fix) - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CyberPanel (https://adminsforum.com/Forum-cyberpanel) +---- Forum: CyberPanel Guides & Tutorials (https://adminsforum.com/Forum-cyberpanel-guides-tutorials) +----- Forum: CyberPanel Email Guides (https://adminsforum.com/Forum-cyberpanel-email-guides) +----- Thread: Guide CyberPanel Email Setup: Mailbox, DKIM, SPF, DMARC (and a DKIM Signing Bug Fix) (/Thread-guide-cyberpanel-email-setup-mailbox-dkim-spf-dmarc-and-a-dkim-signing-bug-fix) |
CyberPanel Email Setup: Mailbox, DKIM, SPF, DMARC (and a DKIM Signing Bug Fix) - JAY - 10-25-2026 CyberPanel Email Setup: Mailbox, DKIM, SPF, DMARC (and a DKIM Signing Bug Fix) CyberPanel ships a full mail server: Postfix to send and receive, Dovecot for IMAP/POP3, and OpenDKIM to sign outgoing mail. Creating a mailbox takes ten seconds. Getting mail into inboxes instead of spam folders takes DNS records, and on our test server one config fix that CyberPanel didn't do for us. Watch it: Part 8 of the CyberPanel course, Email Accounts & Webmail This is Part 8 of 10 in our free CyberPanel Full Course. The written steps below go into more detail. We set up [email protected] on a fresh CyberPanel 3.0 server. DNS for the domain is at Cloudflare. Before you start: can your server send mail at all? Many VPS providers block outgoing port 25 to stop spam. Test it: Code: timeout 6 bash -c '</dev/tcp/gmail-smtp-in.l.google.com/25' && echo PORT25_OPEN || echo PORT25_BLOCKEDCode: PORT25_OPENCode: mail.yourdomain.comStep 1: The mail domain and DNS basics When you create a website with Create Mail Domain ticked, CyberPanel prepares mail for that domain (see creating a website). Then make sure these records exist at your DNS provider:
Step 2: Create the mailbox Open Email > Create Email, pick the website, type the name before the @ and click Generate for a password: Click Use This Password, save it in your password manager, then Create Email Account. You get the message "Mailbox with username [email protected] has been successfully created". Manage existing mailboxes under Email > Email Accounts; change a password under Email > Change Password. Step 3: DKIM DKIM signs every outgoing message with a private key on your server; receivers check the signature with the public key in your DNS. CyberPanel had already created a key for our domain when we created the website. Open Email > DKIM Manager and pick the website. The right column is the public key you publish in DNS: The middle column is the private key. We hid it in the screenshot: never post it or share it. Add a TXT record at your DNS provider:
Step 4: SPF SPF lists which servers may send mail for your domain. Add a TXT record on the domain itself: Code: v=spf1 a mx ~allCode: cyberCode: aCode: mxCode: include:_spf.google.comStep 5: DMARC DMARC tells receivers what to do when SPF/DKIM fail, and sends you reports. Start in monitoring mode: Code: Name: _dmarc (ours: _dmarc.cyber)
Content: v=DMARC1; p=none; rua=mailto:[email protected]Code: p=quarantineCode: p=rejectCheck all three from any Linux machine: Code: dig +short TXT cyber.adminslab.com
dig +short TXT _dmarc.cyber.adminslab.com
dig +short TXT default._domainkey.cyber.adminslab.comStep 6: Check DKIM on the server Check the DKIM record matches the key on the server: Code: opendkim-testkey -d cyber.adminslab.com -s default -vvvStep 7: The bug: mail from the server itself wasn't signed "key OK" doesn't prove messages are actually signed. We sent a test message from the server: Code: apt install -y swaks
swaks -s 127.0.0.1 -f [email protected] -t [email protected]Code: journalctl -t opendkim --since "-5min" --no-pagerCode: /etc/opendkim/TrustedHostsCode: cyber.adminslab.com
localhost.localdomainCode: 127.0.0.1Code: mail()Code: printf '127.0.0.1\n::1\n' >> /etc/opendkim/TrustedHosts
systemctl restart opendkimCode: DKIM-Signature field added (s=default, d=cyber.adminslab.com)Code: cat /etc/opendkim/TrustedHostsStep 8: Send a real test Send a message from the mailbox to a deliverability tester or your own Gmail account, open the original message, and look for SPF: PASS, DKIM: PASS and DMARC: PASS. If one fails, the header usually says why. Mail apps (Outlook, Thunderbird, phone)
Code: https://YOUR-SERVER-IP:8090/manageSSL/sslForMailServerCommon problems
More CyberPanel guides
Tested on CyberPanel 3.0 (build 8, OpenLiteSpeed edition) on Ubuntu 24.04, October 2026. Menu names can change slightly between versions. |