You can send unlimited emails using this free SMTP mail server. I use Virtualmin’s web-based control panel to host a free SMTP server on the Oracle cloud.
Virtualmin is an open-source control panel, and Oracle Cloud provides free VPS for this server. All commands and guidelines are provided, so you don’t have to enter them manually.
Requirements for SMTP Server
Before going through the process, you have to fill in 2 requirements. The first one is that you have to register on Oracle Cloud. It is a very easy task. Use the below link to register for it.
You can use these premium VPS providers to get powerful, low-cost VPS for your SMTP server.
The second one is that you have to get a top-level domain for this. It is better for SMTP servers. Check the video description. You can use the below links to get a top-level domain name at a discounted price.
You can try to get a free domain from Freenom but it is not good for SMTP servers. After fulfilling these requirements, you can go to the next step.
Setup the Free VPS on Oracle Cloud
After logging into the Oracle dashboard, click the “create a VM instance” button to start. You can give your instance any name you want. Under “Image and Shape”, click “Edit” to change the OS of the instance.
Click the “change image” button. Here, select Canonical Ubuntu 24.04 as your operating system, not the minimal version.
Under “Networking”, check whether you selected “Create new virtual network” or “Create new public subnet”. I missed that part here.
You have to add the SSH key to the VPS. Select the “paste public key” option to add the keys. I use Puttygen to get the keys. You can download this software from the article.
After downloading this app, open Puttygen. Click the “Generate” button and move your cursor in this area. Copy the generated key and paste it onto the Oracle Cloud.
After setting up all of these, click the “Create” button to deploy the server. Save your private key in a safe place. It is essential to connect to the server remotely. The server is running now.
Open Ports on the Firewall for Virtualmin
You can see, there is a link called a subnet. Right-click on it and open it in a new window. Click on the subnet name to enter the firewall section. You can open essential ports here. Click the “add ingress rules” button to start.
Enter this IP parameter (0.0.0.0/0) for the source IP. It allows all IP addresses to connect to the server.
You have to enter these TCP ports as the destination ports. You can simply copy and paste the below ports.
This is the port list of Virtualmin
Primary Virtualmin Ports;
- 22 – SSH port
- 80 – HTTP web access
- 443 – HTTPS web access
- 10000 – Virtualmin port
Special Virtualmin Ports;
- 20 – 21 – FTP
- 25 – SMTP (Email)
- 53 (both TCP and UDP) – DNS port (for custom nameservers)
- 110 – POP3 (Email)
- 143 – IMAP (Email)
- 993 – IMAPS (Email)
- 465 /587 – SMTPS (Email)
- 10001 – 10009 – Webmin RPC
- 20000 – Usermin
Copy and paste the below TCP ports.
Add another ingress rule by clicking this button. Enter the same IP parameters as the source IP range. At this time, change the IP protocol to UDP. Enter 53 as the source port and click the “add ingress rules” button.
Now we are finished with opening all the ports that are necessary for the Virtualmin server
Setup Nameserver for Virtualmin
Next to this step, you have to point out the domain to the VPS. You can use two different ways to do that. The first one is to set up nameservers for the VPS, and the second method is to head up manual DNS records.
The easiest and most recommended way is to add nameservers. It gives full control to Virtualmin to handle all the DNS records inside the Virtualmin server.
The platform is different from different domain name providers, but the process is the same. First, log in to the DNS management section of your domain name provider.
I demonstrate this using a different domain name but don’t worry, you have to follow the same procedure that I used here. In Namecheap switch to the advanced DNS section.
Under personal DNS servers, you can add your nameservers. Click the “add nameserver” button and select NS1. After that, enter your server’s external IP address here.
Once again, add the backup nameserver. This time, select NS2 and paste your external IP address.
Switch to the Domain section. You will see a drop-down menu in front of the nameserver section. Select the custom DNS and enter your nameservers NS1 and NS2. Follow this format.
After that, save the changes. It will take some time to propagate the nameservers to the VPS server. You can continue the installation process.
Installation of Virtualmin
You have to connect to the server using SSH. Copy your external IP address and open the Putty app to connect to the terminal. Paste your public IP address as the hostname. Under “SSH”, go to the “Auth” section and add your private key that was previously saved.
Go back to the “Session” tab and save the session using any name. This is very useful when you connect to the server again. You don’t have to enter your credentials again.
Type “Ubuntu” to proceed. Get root access using this command.
You can check the available memory first. See whether it includes a swap file. This server does not have swap space.
We have to add one before the actual installation. The swap file provides additional virtual memory to the system’s RAM. It speeds up the server.
Copy and paste this long command from the article. It automatically adds the swap space to the server, but it takes some time to process.
If you want you can customize the virtual memory by changing the 5024 number
sudo dd if=/dev/zero of=/mnt/swap.0 bs=5024 count=1048576 && sudo mkswap /mnt/swap.0 && echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab && swapon /mnt/swap.0 && sudo swapon -s
Add another ingress rule by clicking this button. Enter the same IP parameter as the source IP range. At this time change the IP Protocol to UDP. Enter 53 as the source port and click the “add ingress rules” button.
Now we are finished with opening all the ports that are necessary for the Virtualmin server
Check the available memory again. You can see the swap space is added to the server.
Next, update the list of packages of the server using this command.
sudo apt-get update
After that, you have to set the hostname. You are unable to enter the main root domain as the hostname and use the subdomain as the hostname. Enter this command to set it. Remember to replace the subdomain with your domain.
hostnamectl set-hostname mail.yourdomain.com
You can check the hostname using this command. It is set correctly.
The initial server setup is over. Next, you can install Virtualmin using this command. I have already run the setup, copy and paste the command from the article.
wget http://software.virtualmin.com/gpl/scripts/install.sh && sudo /bin/sh install.sh
Type “Y” to proceed with the installation. This installation takes some time to finish.
After installation, you will get this screen. Oracle cloud installs an IP table inside the VM instances. You have to enter this command to bypass it, otherwise, it is unable to connect from the web. I already executed the command here.
iptables -P INPUT ACCEPT && iptables -P OUTPUT ACCEPT && iptables -P FORWARD ACCEPT && iptables -F
You can use this URL format to connect the server, paste it into the web browser.
If you see this warning sign, installation is successful. Don’t worry this happens due to the missing SSL certificate in the server. We can add it later. To enter the Webmin control panel, click “Advanced” and select “Accept the risk and Continue”.
This is the login window of the control panel. Let’s set the root password to the server. Go back to the terminal and get root access. Enter this command to set the root password.
Enter your password here and confirm it reentering. It is not visible due to security reasons, just type and hit enter.
The installation process is finished. You can close the terminal now.
Initial Virtualmin configuration
Login into the Webmin control panel using “root” as username and root password as the password. After the login, you will see this post-installation wizard.
There are few simple steps, go through these steps carefully. Here select run domain lookup server. It is better to keep a virus scanner on demand.
It is very important to run spam assassin server filters.
If you plan to run the website on the same server, you can enable the MySQL database. Keep the MySQL password saved. It is useful for your website setup.
Select your MySQL database size. I keep it as a medium because I am not going to run a very large website on this server.
Enter primary and secondary nameservers here. This is different from what we set in the Namecheap. Don’t worry about that because I used different clips to build this video. All the steps are correct and you can easily follow them.
Leave the setting as default. Next, you can choose your virtual server here and generate a let’s encrypt SSL certificate. You can use the default setting for that.
During the getting SSL certificate, the server may be disconnected due to invalidation of the current certificate.
To fix that issue you can refresh the page. After refreshing the page, you will get the same post-installation wizard again. This time you don’t have to manually adjust the settings. because it’s already saved in previously set settings. simply click the next button and finish the setup.
Add Necessary Certificate for SMTP Email Server
After finishing the post-installation wizard, go to the “Edit Virtual Server” section. Make sure you enable the spam filter. If not enabled now.
After that, you have to add an SSL certificate for all the services of Virtualmin. Under “Server Configuration”, select “SSL Certificate”. In this window, navigate to the “Let’s Encrypt” tab.
If you use the nameserver integration method to point out the domain to the server, you can use the first option. Otherwise, you have to select a specific domain to request an SSL certificate. It will take some time to get the certificate.
Switch to the “Service Certificates” tab and copy the certificate for all the services available here.
Now we are done with copying the SSL certificate to Virtualmin. You have to generate a DKIM certificate for the mail server.
Under “Email Setting” select “Domain Key Identified Mail”. Install the DKIM generator app to the server. It will automatically create DKIM keys for the mail server. After that enable sign outgoing mail and save the settings.
You can see all the DNS records and mail server certificates including DKIM in the DNS section.
Create Email User and Send Email
To add the new mail user for this server, go to the “Edit Users” section. Add a new mail user to send emails. Create an email account with a password, leave other settings default.
Now, all set you can send email using this SMTP server. I use Gmass SMTP mail sender to test this.
Enter your mail server details. If you use a root domain, your SMTP hostname will be mail. your domain.com. Both username and email address is a previously created user email. Enter the user account password and port is 587. Change the security level to “None” and set the received email address.
Click the “Test it” button to send the email. Check your email account, the email will be received to your email.
Sometimes the email goes to the spam folder. In future videos, I will give a better solution for a free SMTP server. Using that method, you can send 100% of inbox emails without going to the spam folder.
If you have any issue regarding this tutorial, ask directly on MineX Tuts Community Forum. Thank You.