Installation of Mautic

Installing Mautic Email Marketing Tool Using Docker: A Simplified Guide

Mautic, an open-source marketing automation tool, can be installed in various ways, but this guide focuses on using Docker for its simplicity and efficiency. Docker allows for easy deployment and management of Mautic, making it an ideal choice for users looking for a straightforward installation process. While other methods exist, this guide emphasizes the Docker approach as it streamlines the setup and configuration of Mautic.


Installing Mautic with Docker

Pulling the Docker Image

To begin the installation process, the first step is to pull the latest stable Mautic image from Docker Hub. Run the following command in your terminal.

docker pull mautic/mautic:latest

Running Basic Containers

Before running Mautic, it's necessary to set up a MySQL server. Create a Docker volume for MySQL data:

docker volume create mysql_data

Next, run the MySQL container (using Percona as an example):

docker run --name percona -d \
    -p 3306:3306 \
    -e MYSQL_ROOT_PASSWORD=mypassword \
    -v mysql_data:/var/lib/mysql \
    percona/percona-server:5.7 \
    --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
Now, create a Docker volume for Mautic data:
docker volume create mautic_data

Finally, run the Mautic container:

docker run --name mautic -d \
    --restart=always \
    -e MAUTIC_DB_HOST=127.0.0.1 \
    -e MAUTIC_DB_USER=root \
    -e MAUTIC_DB_PASSWORD=mypassword \
    -e MAUTIC_DB_NAME=mautic \
    -e MAUTIC_RUN_CRON_JOBS=true \
    -e MAUTIC_TRUSTED_PROXIES=0.0.0.0/0 \
    -p 8080:80 \
    -v mautic_data:/var/www/html \
    mautic/mautic:latest

This will launch a basic MySQL service within Mautic, accessible at http://localhost:8080.


Customizing Mautic Container

Database Options

Mautic container provides various environment variables for database configuration:

If using an external database, provide the hostname, port, password, and username accordingly.

Mautic Options

Several environment variables control Mautic's behavior:

Enable/Disable Features

PHP Options

Persistent Data Volumes

Mautic stores data at /var/www/html, requiring a volume for persistence.

Mautic Versioning

Specify the Mautic version and SHA1 hash using the following environment variables:


Accessing the Mautic Instance

After successfully setting up Mautic, access it at http://localhost:8080 or http://host-ip:8080 in a web browser.


Using Docker-Compose

For a more organized setup, use Docker Compose. Here's an example docker-compose.yml file:

version: '2'

services:

  mauticdb:
    image: percona/percona-server:5.7
    container_name: mauticdb
    volumes:
      - mysql_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mysecret
    command:
      --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
    networks:
      - mautic-net

  mautic:
    image: mautic/mautic:latest
    container_name: mautic
    links:
      - mauticdb:mysql
    depends_on:
      - mauticdb
    ports:
      - 8080:80
    volumes:
      - mautic_data:/var/www/html
    environment:
      - MAUTIC_DB_HOST=mauticdb
      - MYSQL_PORT_3306_TCP=3306
      - MAUTIC_DB_USER=root
      - MAUTIC_DB_PASSWORD=mysecret
      - MAUTIC_DB_NAME=mautic
      - MAUTIC_RUN_CRON_JOBS=true
    networks:
      - mautic-net

volumes:
  mysql_data:
    driver: local
  mautic_data:
    driver: local
networks:
  mautic-net:
    driver: bridge
Run docker-compose up, wait for initialization, and access Mautic at http://localhost:8080 or http://host-ip:8080.

Conclusion

By opting for Docker as the installation method for Mautic, users benefit from a simplified and efficient process. This guide covers the basics of pulling the image, running containers, customization options, and utilizing Docker Compose for a more organized deployment. Access Mautic through the provided URLs and leverage its powerful marketing automation features with ease.

Adding Email Server Settings to Mautic

Mautic allows you to configure email server settings to send emails efficiently. Follow these steps to add email server settings:

  1. Log in to Mautic:

    • Open your web browser and navigate to your Mautic instance.
    • Log in using your administrator credentials.
  2. Access Configuration Settings:

    • Once logged in, click on the "Settings" gear icon located in the top right corner.
    • From the dropdown menu, select "Configuration".
  3. Navigate to Email Settings:

    • In the Configuration menu, select "Email Settings" from the left-hand sidebar.
  4. Choose Email Service:

    • Under the Email Settings section, you'll see options for various email services such as SMTP, Amazon SES, SendGrid, etc. Choose the appropriate service according to your preference or requirement.
    • For this guide, we'll focus on setting up SMTP, which is a common choice.
  5. Configure SMTP Settings:

    • Select "SMTP" from the list of email services.
    • Fill in the SMTP server details provided by your email service provider or your IT department. This typically includes:
      • SMTP Hostname: The address of your SMTP server (e.g., smtp.example.com).
      • SMTP Port: The port number used for SMTP communication (e.g., 587 for TLS).
      • SMTP Encryption: Select the appropriate encryption method (e.g., None, SSL, TLS).
      • SMTP Authentication: Enable this option if your SMTP server requires authentication.
      • SMTP Username/Password: Enter the credentials for authenticating with the SMTP server.
      • Sender Email Address: The email address from which emails will be sent.
      • Sender Name: The name associated with the sender's email address.
  6. Test Connection:

    • After filling in the SMTP details, click on the "Test Connection" button to ensure that Mautic can successfully connect to your SMTP server.
    • If the connection is successful, you'll receive a confirmation message. If not, double-check your SMTP settings for any errors.
  7. Save Settings:

    • Once the connection test is successful, click on the "Save & Close" button to save your email server settings.
  8. Verify Email Sending:

    • To verify that your email server settings are working correctly, you can send a test email to yourself or another email address.
    • Navigate to "Channels" > "Emails" and create a new email campaign or test email.
    • Send the email and verify that it is delivered successfully to the intended recipients.

By following these steps, you should be able to add and configure email server settings in Mautic effectively. If you encounter any issues, double-check your settings and consult with your email service provider or IT department for further assistance.