✅ Simple Guide: Add New Domain to Mail Server

Follow these easy steps to add your domain. We'll use examples to make it clear!

Enter details above and click Update to customize the guide and credentials.

Step 1: Update DNS Records

This is where you tell the internet how to find your new email setup. Go to your DNS provider (like Cloudflare) and add these records.

Wait 5-30 minutes for changes to take effect. Test by typing dig mx example.com in a terminal.

Example with Cloudflare:
1. Log in to dash.cloudflare.com.
2. Select your domain > DNS tab > Add Record.
3. For A: Type = A, Name = mail, IPv4 = 76.13.209.253, Proxy = Off.
4. For MX: Type = MX, Name = @, Server = mail.example.com, Priority = 10.
5. Save and wait.

Step 2: Create an Email User (Adds Domain Support)

Connect to your server (VPS) using SSH. Run this to add the email user—the domain gets supported automatically.

cd /opt/docker-mailserver
sudo docker exec -it mailserver setup email add noreply@example.com YourStrongPassword123

A strong password has letters, numbers, and symbols (e.g., Pass123!@).

Step 3: Set Up DKIM (Helps Emails Reach Inbox)

Run this to get a special code. Add it to your DNS.

sudo docker exec -it mailserver setup config dkim domain example.com

The output will give you a TXT record. Add it in DNS as Name = mail._domainkey, Value = the long string.

Cloudflare Example:
Add Record: Type = TXT, Name = mail._domainkey, Value = v=DKIM1; k=rsa; p=... (from output), Proxy = Off.

Step 4: Restart the Server

Restart to apply all changes. This takes a few seconds.

sudo docker compose down && sudo docker compose up -d

Step 5: Add SPF Record (Stops Spam Flags)

Add this to DNS to verify your server can send emails.

v=spf1 a:mail.example.com mx ip4:76.13.209.253 ~all

Name = @, Type = TXT.

Cloudflare Example:
Add Record: Type = TXT, Name = @, Value = the SPF code above.

Step 6: Test in Xsender

Go to Xsender settings and enter these details. Then send a test email to yourself.

If it doesn't work, check your inbox/spam or ask for help.

Your New SMTP Credentials

Use these in Xsender or any email app to send mails from your new domain.

SettingValue
Hostpostal.pitech.com.bd (or mail.example.com)
Port587
EncryptionSTARTTLS
Usernamenoreply@example.com
PasswordYourStrongPassword123

Note: Change password if needed with: sudo docker exec -it mailserver setup email update-password noreply@example.com newpassword

💡 Quick Tips
• Always use SSH to run commands on the server.
• If stuck: Run docker logs mailserver to see errors.
• DNS changes: Use dnschecker.org to check.