Mailgun is an automated email service that enables you to send, receive, and track emails from your websites and applications. It also facilitates email management for marketing and other purposes.
NB: Port 25 is closed for connection on VMs by default. If you want to open port 25, buy Mail Bridge and configure it in Starlight™ Manager.
To configure the MailGun email on WHM, please use this guide.
Please follow the steps below to configure the Mailgun service and Email System for your domain name on the CyberPanel side:
Step 1. Sign up for Mailgun. They suggest many account plans at different prices that you can see here:

You can sign up and register an account for free. In this case, ensure the “Add payment info” checkmark is not selected.
NB: Accounts without a credit card are limited to sending 100 messages a day:

Once everything is filled in, click on “Create Account”.
Step 2. Verify your email account by clicking on the “Verify your email address” button inside the corresponding email from Mailgun:

Step 3. Set up the Mailgun Sender Authentication. There are two ways of doing that:
Method 1:
Log into your Mailgun account >> click on the “Send” section of the menu on the left >> “Sending” >> “Domain Setting;
Inside the “Domain Settings” menu, go to the “Setup” section;
Add authorized recipients by entering a needed email address into the “Email address” field >> click “Add”:

After that, you will receive an email to the specified email address. To confirm its addition, press the "I Agree" button:

You will be redirected to a new tab in the browser. Click on the "Yes" button to confirm the email address addition:

Once done, you’ll receive a “Success” message that means the email account in question was added:

Method 2:
Log into your Mailgun account >> click on the “Send” section of the menu on the left >> “Sending” >> “Domains”. From this section, click on the “Add new domain” button:

You will be redirected to a page from where it’s possible to add a new domain to the Mailgun system. Enter the desired domain into the “Domain name” field, choose the needed options and advanced settings, and click on “Add Domain”:

After that, it is necessary to verify the domain name added by configuring the corresponding TXT and MX DNS records for the domain.
The list of the records that should be added as well as their status can be checked in your Mailgun account >> the “Send” section of the menu on the left >> “Sending” >> “Domains” >> go to the “DNS Records” section.
Once the DNS records are created for the domain, click the "Verify" button on the top right:

NB: It may take up to 24-48 hours for the DNS records to propagate.
Once the propagation is over and all the needed DNS records are added to the domain, the Mailgun system will verify it. The domain will now be listed under the “Domains” section of the “Sending” menu:

Step 4. The next step will be configuring SMTP settings for the email account on the WHM side.
To get the needed SMTP credentials log into your Mailgun account >> click on the “Send” section of the menu on the left >> “Sending” >> “Domain Settings”. From this section, open the “SMTP credentials” tab.
Copy the value under the “Login” field, reset the password and save the details for the next step:

Step 5. Edit Postfix configuration file
In Mailgun, open “Domain settings” from the left hand side menu and select your domain and click SMTP credentials. Here you will get your host, login user and password. Click on reset password to get your password, simply copy it and save it.

Open the Postfix configuration file /etc/postfix/main.cf in the text editor of your choice
nano /etc/postfix/main.cf
orvi /etc/postfix/main.cf
Add the following lines to the bottom of the file:
relayhost = MAILGUN_HOST:587smtp_sasl_auth_enable = yessmtp_sasl_password_maps = static:MAILGUN_USER:MAILGUN_PASSsmtp_sasl_security_options = noanonymous
MAILGUN_HOST is the actual Mailgun host from your account
MAILGUN_USER is the actual Mailgun smtp user
MAILGUN_PASS is the actual SMTP password from your Mailgun account.
Save the file and restart postfix by running systemctl restart postfix
Now, you may test the email delivery. In your CyberPanel, open Email -> Access Webmail. Enter your email and password there.