Skip to content
 
 

Repository files navigation

MXRoute Email Forwarder with Docker

This guide helps you set up a simple web application to manage email forwarders on MXroute servers. It uses a self-contained Docker setup, which is great for running on a home server or NAS without needing to install extra software.


Getting Started

Quick Setup

  1. Download the files: Get the mxroute-forwarder application files.
  2. Place the files: Put the Docker files (Dockerfile, docker-compose.yml) in the same folder as your application's PHP files.
  3. Launch the app: Open a terminal in that folder and run this command:
    docker-compose up -d --build
  4. Access the application: Once the command is finished, open your web browser and go to http://your-server-ip:3311.

Folder Structure

Your project folder should be set up like this:

mxroute-forwarder/
├── Dockerfile
├── docker-compose.yml
├── config.php
├── DirectAdminAPI.php
├── index.php
└── manage_forwarder.php

Configuration

Changing the Port

The application is set to be accessible on port 3311 by default. To change this, you'll need to edit the docker-compose.yml file.

  1. Open the file in a text editor.
  2. Find the ports: section. It looks like this:
    ports:
      - "3311:80"
  3. Change only the first number to your desired port. The second number (80) must always stay the same, as it's the port inside the Docker container.
  4. After saving the file, you'll need to rebuild and restart the container to apply the change:
    docker-compose down
    docker-compose up -d --build

Updating Your Server Information

You must tell the application which MXroute server to connect to. To do this:

  1. Open the config.php file.
  2. Find this line:
    define('DEFAULT_DA_SERVER', 'glacier.mxrouting.net');
  3. Change 'glacier.mxrouting.net' to your specific MXroute server address. You can find this in your welcome email or DirectAdmin dashboard.

Common Docker Commands

Here are some commands you'll use frequently to manage the container:

  • Start the application: docker-compose up -d --build
  • Stop the application: docker-compose down
  • View what's happening: docker-compose logs -f
  • Restart the application: docker-compose restart
  • Rebuild and restart: docker-compose down && docker-compose up -d --build

Updating the Application

If you download new PHP files for the application, you need to update your Docker container to use them.

  1. Replace the old files in your project folder with the new ones.
  2. Rebuild the container with this command:
    docker-compose down && docker-compose up -d --build
    This process stops the old container and creates a new one with the updated files.

NAS-Specific Notes

This Docker setup works well on many popular network-attached storage (NAS) devices.

  • Synology NAS: Use Container Manager or SSH. The default port 3311 should work fine. Access it at http://your-synology-ip:3311.
  • QNAP NAS: Use Container Station or SSH. You may need to check your firewall settings to make sure the port is open. Access it at http://your-qnap-ip:3311.
  • TrueNAS/FreeNAS: Use the Apps section or SSH. Ensure that port 3311 isn't blocked by your firewall. Access it at http://your-truenas-ip:3311.

Troubleshooting

Container Won't Start

  • Check the logs: Run docker-compose logs to see what went wrong.
  • Is the port in use? Another application might be using the port you've chosen. To check, run sudo lsof -i :3311 (replace 3311 with your port).

Can't Access the Application in My Browser

  • Is the container running? Use docker-compose ps to see the status. It should show as Up.
  • Check your NAS firewall: Make sure the port you're using isn't blocked.
  • Check the logs again: Run docker-compose logs -f to watch for real-time errors as you try to connect.

"Permission Denied" Errors

  • This often happens if the Docker process can't read your files. Try fixing the file permissions with chmod -R 755 . before you build the container.

Important Requirements

  • You must have Docker and Docker Compose installed on your server.
  • You need an MXroute account with DirectAdmin access.
  • Your server must be able to connect to the MXroute servers over the internet.

About

MX-Route create forward email

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages