This article outlines basic steps for setting up a mail server using popular components such as Postfix and Dovecot. Please note that mail server setup may vary depending on the selected software and operating system, as well as the environment’s specific settings. This article is focused on the Ubuntu and Debian operating systems.Please note : The use of email sending services must not violate our terms of use. Suspicious requests will be rejected and, if necessary, accounts will be blocked.
Create an Virtual Machine.
Install Cloud VM using our guide. The minimum available configuration—1vCPU and 2 GB RAM—will be enough to install and run a mail server on your VM.
Check internet access.
Check the Network settings tab in the machine settings. The interface must be set to the public to access the internet.
However, if you first chose the option private method, then you need to get a floating IP address to access the internet.Please note : By default, Gcore Cloud VM has limits on SMTP port 25. In order to open a port and successfully install a mail server, contact support and click Create Ticket.
Connect to your Gcore Cloud VM via either SSH or the VNC concole in the Customer Portal.
Install Postfix.
Postfix is one of the popular Mail Transfer Agents (MTAs) responsible for sending and delivering mail messages. To install Postfix, run the following commands:
Copy
Ask AI
sudo apt-get updatesudo apt-get install postfix
During Postfix installation, you will be prompted to select a configuration type. Select the Internet Site option and enter the fully qualified hostname of your server, then click <Ok>.
Configure Postfix.
Navigate to the Postfix configuration file:
Copy
Ask AI
sudo nano /etc/postfix/main.cf
In this configuration file, edit the following parameters:
myhostname : Specify the fully qualified domain name of the Virtual Server on which Postfix is running.
mydestination : Specify the domains for which mail will be delivered locally instead of being forwarded to another host.
mynetworks : Specify a list of networks or IP addresses from which mail messages are allowed to be sent through this server.
Save the changes and restart Postfix:
Copy
Ask AI
sudo service postfix restart
More information about Postfix is available in their documentation.
Install Dovecot.
Dovecot is an IMAP (Internet Message Access Protocol) and POP3 (Post Office Protocol 3) server that provides access to mailboxes. It is required during the mail server setup, so installing it will be the next step. Use the following command to install Dovecot:
Create a password for each user and retype it. The password will be saved automatically.
Add DNS records.
Next, you should manage the DNS settings. Use our PD guide to get step-by-step configuration instructions.
Test and verify.
Restart Postfix and Dovecot to apply the changes.
Copy
Ask AI
sudo service postfix restartsudo service dovecot restart
You can use an email client (for example, Thunderbird) to send a test email from one of the email addresses you created. After sending a test email, check your email client or webmail to receive this email. Analyze the Postfix and Dovecot logs, located in the following directory: