Janna Theme License is not validated, go to the theme options page to validate the license, you need a single license for each domain name.

How to Create an Email Server in Linux Using Mail-In-A-Box

Mail-in-a-Box is a small but powerful program that aims to create a multi-functional email server solution that's easy to deploy on your machine. This tutorial shows you how to install Mail-in-a-Box on your system. Ubuntu Linux.

How to Create a Mail Server in Linux Using Mail-In-A-Box

Why Host Your Own Email Server?

One of the biggest advantages of hosting your own email server is that it gives you privacy over your private data. Unlike a webmail service like Gmail, running Mail-in-a-Box ensures that there is no middleman between you and your emails.

How to Create an Email Server in Linux Using Mail-In-A-Box

A self-hosted server also gives you flexibility in how you interact with your email. For example, Gmail uses labels instead of folders to organize messages. This often breaks offline clients trying to fetch email from Gmail accounts.

How to Create a Mail Server in Linux Using Mail-In-A-Box

Finally, hosting your own server allows you to bypass identity verification when creating an email account. This is useful if you're concerned about privacy and don't want to share your information with third-party providers.

How to Create a Mail Server in Linux Using Mail-In-A-Box

Preparing your email server

Before you can install Mail-in-a-Box, you need to make sure you have a running server and a domain name. This article was written on an Ubuntu VPS. digitalocean.

How to Create a Mail Server in Linux Using Mail-In-A-Box

To get started, you'll need to configure your domain as a nameserver pointing to your own machine. This is important because Mail-in-a-Box manages its own DNS records internally.

Also read:  What to do after installing Ubuntu for the first time to improve performance and user experience

Note: Configuration varies for each domain registrar, so we won't walk through the instructions for creating a nameserver. What you'll need to do is create two nameservers: ns1.your-domain-name.com and ns2.your-domain-name.com, to point to your server's IP address. You'll also need to change the domain nameserver record to the one you created.

How to Create a Linux Email Server Using Mail-In-A-Box Update your device's hostname

With your domain name and nameserver configured correctly, you now need to modify your device's hostname. This will allow Mail-in-a-Box to set the default values correctly during installation.

You can do this in Digitalocean by doing the following:

  1. Go to Droplet application status page Your.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  2. Click on the name of the droplet, replace it with your domain name, and click the check mark to save it.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  3. Log in to your VPS instance as root and run the following command:
    echo "box" > /etc/hostname

    How to Create a Mail Server in Linux Using Mail-In-A-Box

  4. Next, run the following command to change the file: etc. /hosts/ Your device to your current domain name:
    awk '$1 == "127.0.1.1" { print $2 }' /etc/hosts | sed -is/.*/box.yourdomain.here/ awk '$1 == "127.0.1.1" { print $3 }' /etc/hosts | sed -is/.*/box/

    How to Create a Linux Email Server Using Mail-In-A-Box

  5. Restart your device to apply the new changes.
    How to Create a Linux Email Server Using Mail-In-A-Box

Install Mail-in-a-Box

After doing this, you can now start installing Mail-in-a-Box on your device.

  1. Start the process by getting the Mail-in-a-Box installation script:
    curl -s https://mailinabox.email/setup.sh | sudo -E bash
  2. Enter the email address you want to use for your mail server.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  3. Provide a host name for your mail server. In my case, I'll use the default option. “box.myvpsserver.top”.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  4. The installation script will then ask you for a time zone. For this, you need to provide your current time zone instead of the server's actual location.
    How to Create a Linux Email Server Using Mail-In-A-Box
  5. Type the password you want to use for your email account.
    How to Create a Linux Email Server Using Mail-In-A-Box

Tip: If you're using Outlook instead, learn about How to schedule your emails in Outlook.

Configure your email server

At this point, you now have the Mail-in-a-Box server properly installed on your device. However, you still need to configure some of its settings to use it properly.

  1. Open the link that the installer wrote at the end of the script.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  2. When loading the website, your browser may throw a security exception. This is because Mail-in-a-Box uses a self-signed certificate for its initial website.

You can safely bypass this error by clicking "advanced" , Then “Accept the risk and follow through.”

How to Create a Linux Email Server Using Mail-In-A-Box

2. Log in to your Mail-in-a-Box instance by providing your new email account and password.
How to Create a Mail Server in Linux Using Mail-In-A-Box

3. Click on "the system" , Then TLS (SSL) certificates.
How to Create a Mail Server in Linux Using Mail-In-A-Box

4. Click the button "to provide" To create an SSL certificate for your server's subdomains.
How to Create a Linux Email Server Using Mail-In-A-Box There are cases where Mail-in-a-Box doesn't request an SSL certificate for all your subdomains. You can fix this by clicking the button. "to provide" once again.

5. Click "the system" , Then Status checks To make sure everything is working properly.
How to Create a Linux Email Server Using Mail-In-A-Box

Tip: Learn more about SSL and encryption by creating your own self-signed certificate using OpenSSL.

Send and verify your first email

From here, you can now log in and use your Mail-in-a-Box server. Unlike other self-hosted mail solutions, Mail-in-a-Box offers a simple and intuitive web interface that you can use and get started right away. This means you don't need to install any external mail clients to use Mail-in-a-Box.

  1. Enter the web interface in your browser by typing: “https://yourdomain.com/mail.”
    How to Create a Webmail Client in Linux Using Mail-In-A-Box
  2. Enter your new email address and password on the server login page.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  3. Click the button "construction" To create a new email message.
    How to Create a Mail Server in Linux Using Mail-In-A-Box
  4. Provide a valid email recipient and write a simple test message.
  5. Once done, click the button "send".
  6. Finally, check if your mail has reached the intended recipient by loading their inbox.
    How to Create a Linux Email Server Using Mail-In-A-Box

Frequently Asked Questions

Q1: Is it possible to reconfigure my email server after installation?
The answer: Yes. You can reconfigure any of the server's internal settings by going to the device's console and running the following command: sudo mailinabox.

Q2: Can I create a different email account in my Mail-in-a-Box server?
The answer: Yes. By default, Mail-in-a-Box allows you to create multiple email accounts on the same server. To do this, go to the Mail-in-a-Box admin page, click Mail and Users , Then "user"This will load a prompt where you can provide an email address and password for a new user.

Q3: My mail is not reaching the intended recipient.
The answer: The most likely reason for this is that your device's IP address is on an email block list. To fix this issue, you can either request a new IP address "Not based on ban" From your service provider or create a new VPS instance. Another way is to use a third-party SMTP server to help you send your emails.

Also read:  Best Ways to Optimize Storage Space and Disk Management on Ubuntu
Go to top button