I
I
Igor2020-02-22 03:39:23
symfony
Igor, 2020-02-22 03:39:23

How to properly configure docker-mailserver?

Colleagues, welcome!

"Using" docker-mailserver
Unable to send mail.

What I did to achieve my goal:

  1. Configured docker-compose.yml
  2. Raised containers
  3. Followed all the recommendations (I hope)
  4. Installed the necessary components in Symfony (" symfony/swiftmailer-bundle": "^3.4" )
  5. Set up MAILER_URL


Sending a command
docker exec -it mail.app bin/console swiftmailer:email:send

[OK] 1 emails were successfully sent.

There was no letter and no.
How to make sure docker-mailserver is properly configured?
docker-mailserver constantly writes something to the logs, for example
2020-02-21 18:25:11,164 INFO exited: postfix (exit status 0; expected)

2020-02-21 18:25:11,180 INFO spawned: 'postfix' with pid 16771

2020-02-21 18:25:11,181 INFO success: amavis entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)

Feb 21 18:25:10 mail amavis[16758]: starting. /usr/sbin/amavisd-new at mail.dev.com amavisd-new-2.10.1 (20141025), Unicode aware

Feb 21 18:25:11 mail amavis[16758]: (!)Net::Server: 2020/02/21-18:25:11 Can't connect to UNIX socket at file /var/lib/amavis/amavisd.sock [Input/output error]\n at line 70 in file /usr/share/perl5/Net/Server/Proto/UNIX.pm

2020-02-21 18:25:11,215 INFO success: postfix entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)

2020-02-21 18:25:13,189 INFO exited: amavis (exit status 1; not expected)

Feb 21 18:25:12 mail amavis[16770]: starting. /usr/sbin/amavisd-new at mail.dev.com amavisd-new-2.10.1 (20141025), Unicode aware

Feb 21 18:25:13 mail amavis[16770]: (!)Net::Server: 2020/02/21-18:25:13 Can't connect to UNIX socket at file /var/lib/amavis/amavisd.sock [Input/output error]\n at line 70 in file /usr/share/perl5/Net/Server/Proto/UNIX.pm

2020-02-21 18:25:13,221 INFO spawned: 'amavis' with pid 16815


docker-compose

# Development configuration
version: "3.7"

services:

  # Php application
  app:
    container_name: mail.app
    restart: on-failure
    build:
      context: .
      dockerfile: ./docker/php/Dockerfile-dev.docker
    volumes:
      - ./docker/timezone:/etc/timezone
      - .:/www
      - ./docker/php/log:/var/log
      - ./docker/php/usr/local/etc/php/conf.d:/usr/local/etc/php/conf.d
    depends_on:
      - db
    links:
      - db
    expose:
      - "9000"
    environment:
      PHP_INI_SCAN_DIR: ":/usr/local/etc/php/conf.d"
      TZ: "Europe/Moscow"

  # Database
  db:
    image: percona:latest
    container_name: mail.db
    restart: on-failure
    ports:
      - "127.0.0.110:3306:3306"
    expose:
      - "3306"
    volumes:
      - ./docker/timezone:/etc/timezone:ro
      - ./docker/mysql/dumps:/var/mysql/dumps
      - ./docker/mysql/test-data:/var/mysql/test-data
    environment:
      - MYSQL_USER=root
      - MYSQL_ROOT_PASSWORD=ra3kw1UD20Sa6G1dqOEF4L1pmNkcyQ2oL
      - MYSQL_DATABASE=mail
      - MYSQL_ROOT_HOST=%

  # Mail
  mail:
    image: tvial/docker-mailserver:latest
    hostname: mail
    domainname: dev.com
    container_name: mail
    depends_on:
      - app
    ports:
      - "127.0.0.110:25:25"
      - "127.0.0.110:143:143"
      - "127.0.0.110:587:587"
      - "127.0.0.110:993:993"
    volumes:
      - ./docker/mail/dev/maildata:/var/mail
      - ./docker/mail/dev/mailstate:/var/mail-state
      - ./docker/mail/dev/maillogs:/var/log/mail
      - ./docker/mail/dev/config/:/tmp/docker-mailserver/
      - ./docker/mail/utils:/var/mail/utils
    environment:
      - ENABLE_SPAMASSASSIN=1
      - ENABLE_CLAMAV=1
      - ENABLE_FAIL2BAN=1
      - ENABLE_POSTGREY=1
      - ONE_DIR=1
      - DMS_DEBUG=0
      - SMTP_ONLY=1
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question