To open port 25 on your Virtual Machine (VM), go to Starlight Manager > choose the "Mail Bridge" Tab > press the ‘Add Mail Bridge’ button.
Once the PTR record is set and port 25 is enabled, you can set up your preferred SMTP server. Below are examples for Postfix, Exim, and Sendmail. Use the VM IP shown in your Starlight Manager, and make sure your domain name for the PTR record matches your sender domain (e.g., mail.example.com).
|
When Postfix is installed, you can start the service and make sure it starts after your server is rebooted:
|
Then, you can configure the service. All options needed for the service are located in the /etc/postfix directory, and the main configuration file is /etc/postfix/main.cf
Run the sudo nano /etc/postfix/main.cf command to start editing the main configuration file and add or update these lines:
|
Restart Postfix to apply the changes:
|
Test sending mail:
|
|
The command below displays a wizard user interface for configuring the software. It allows users to decide if Exim needs to split its configuration across multiple files or to store it in one file:
|
If the first option is used, the configuration will be stored in the /etc/exim4/conf.d subdirectories. If one configuration file is chosen, it will be /etc/exim4/exim4.conf
When all configurations are done, run systemctl restart exim4so the changes take effect.
Edit /etc/exim4/update-exim4.conf.conf to ensure:
|
Restart Exim to apply the changes:
sudo systemctl restart exim4
Test email delivery by running the command below:echo "Mail test" | mail -s "Exim Test" user@recipient.com
|
The main configuration file of Sendmail is /etc/mail/sendmail.cf. Avoid editing this file directly. If there is a need to edit the configuration, edit the /etc/mail/sendmail.mc file instead, back up the original config file, and use one of the following alternatives to generate a new config file:
1) Use the included makefile /etc/mail to create a new config:
|
All generated files in /etc/mail will be regenerated if there is a need.
2) Alternatively, you may use the m4macro processor to create a new /etc/mail/sendmail.cf. The m4macro processor is not installed by default. Before using it to create /etc/mail/sendmail.cf, install the m4package as root:
|
The following Sendmail configuration files are located in the /etc/mail/directory:
access- specifies which systems can use Sendmail for outbound mail
domaintable- domain name mapping
local-host-names - aliases for the server host
mailertable- instructions that override routing for the particular domains
virtusertable- specifies a domain-specific form of aliasing, allowing multiple virtual domains to be hosted on the machine.
Below, you may see the examples of how the configuration files can be edited:
|
Several of the aforementioned configuration files must store their information in database files before any changes can take effect. To include any changes made in the configuration files, run the makemap hash /etc/mail/<name> < /etc/mail/<name>command as root. Here, <name> represents the name of the configuration to be updated.
Restart the Sendmail process by running the systemctl restart sendmail command.