How to configure an email account in virtualmin
Configuring an email account in Virtualmin involves several steps, including setting up your domain, creating email users, and ensuring proper email server configurations. Here’s how to do it:
1. Add a Domain to Virtualmin
Before creating email accounts, ensure the domain is added to Virtualmin:
1.Log in to the Virtualmin panel:
https://<your-server-ip>:10000
2. Go to Virtualmin (from the top-left dropdown menu).
3.Click on Create Virtual Server.
4.Fill in the domain details:
•Domain name: Enter the domain (e.g., example.com).
•Description: Optional.
•Admin password: Set the administrator password.
5.Click Create Server.
2. Create an Email Account
1.Navigate to your virtual server/domain in Virtualmin.
2.Go to Edit Users under the Email Settings section.
3.Click Add a user to this server.
4.Enter the following details:
•Username: Choose the username (e.g., user1).
•Real Name: Optional (e.g., John Doe).
•Email Address: Automatically generates based on the username and domain.
•Password: Set a password or generate one.
5.Click Create.
3. Configure DNS Records for Email
Ensure your DNS settings include the necessary records for email functionality:
1.MX Record: Points to your mail server.
•Example:
example.com. IN MX 10 mail.example.com.
2.A Record: For mail.example.com, point to your server’s IP address.
•Example:
mail.example.com. IN A <server-ip>
3. SPF Record: Add an SPF record to allow your server to send emails.
•Example:
v=spf1 mx ~all
4.DKIM: Enable DKIM in Virtualmin under Email Settings > DomainKeys Identified Mail.
5.DMARC Record: Add a DMARC record for better email deliverability.
•Example:
_dmarc.example.com. IN TXT “v=DMARC1; p=none”
4. Test the Email Configuration
Access Email via Webmail
1.Install a webmail client like Roundcube or Usermin:
•Install Usermin (if not already installed):
sudo apt install usermin # Ubuntu/Debian
sudo yum install usermin # CentOS/RedHat
•Access Usermin:
https://<your-server-ip>:20000
2.Log in using the email account credentials.
Configure Email Clients (e.g., Outlook, Thunderbird)
•Use these settings:
•IMAP/POP3 Server: mail.example.com
• SMTP Server: mail.example.com
•Port:
•IMAP: 143 (or 993 for SSL)
•POP3: 110 (or 995 for SSL)
•SMTP: 25, 587, or 465 (for SSL)
•Username: Full email address (e.g., user1@example.com).
•Password: The password for the email account.
5. Check Email Delivery
Send a test email to verify sending and receiving functionality. If there are issues:
•Logs: Check mail logs for errors.
sudo tail -f /var/log/mail.log # Ubuntu/Debian
sudo tail -f /var/log/maillog # CentOS/RedHat
•Firewall: Ensure ports 25, 587, 143, 993, 110, and 995 are open.
6. Enable SSL for Email (Optional but Recommended)
1.Go to Server Configuration > Manage SSL Certificate.
2.Enable SSL for mail services.
3.Update your email client to use secure ports for IMAP, POP3, and SMTP.