Sending emails with CyberPanel does not work by default. Since the team of CyberPanel made it open-source, they didn't implement automatic configuration of Dovecot or Postfix. So, it needs to be modified/configured manually.
Let's start:
First of all, let's modify the postfix configuration (execute the following command on the terminal): nano /etc/postfix/main.cf
myhostname = server1.domain-name.tld
mynetworks = 127.0.0.0/8
Make sure to replace your own hostname with server1.domain-name.tld and the hostname should be pointed at the server's main IPv4. Also, replace your server's IP at mynetworks. If your server had a single IP, it should be with /32, or, add the whole IP with its range, if your server has multiple IPs. At the end of the /etc/postfix/main.cf file, add the following line:
tls_server_sni_maps = hash:/etc/postfix/vmail_ssl.map
Once it will be done, run the command to restart the Postfix service: service postfix restart
If you have a mail connection issue with SSL after performing the above changes, add the following lines to /etc/postfix/main.cf file (at the end):
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
Once done, again, save the changes and restart the Postfix service once more time.
Some tips for making sure that mail service works fine:
- Make sure to add rDNS (Reserved DNS) from the server control panel so that the mail does not go to the spam folder/dir.
- Also, the IP should be clean, if the IP is added any RBL, remove them (contact the service provider if you need further help)
- An SSL certificate should be installed at the hostname (the hostname and rDNS should be the same if its a shared server)
- Configure DKIM, DMARC, SPF, MX, and other TXT records that are used to validate the authentication of the domain correctly
- Make sure to configure SMTP, POP3/IMAP correctly, and test mail results with mail-tester.com before onboarding your service!
If you need paid mail service, feel free to contact us! We're here to help you anytime!