phpdockeremailgmailmailcatcher

Catch gmail acount emails with Mailcacther


I am using Gmail as a mailing server for testing purposes on dev docker.

I had enabled MSMTP on docker

RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/sendmail.ini

msmtprc configuration

tls on
auth on
host smtp.gmail.com
port 587
user ******@gmail.com
from webserver@webserver.com
password **********

This is a working solution for sending emails to designated email addresses.

But I need to catch mails with mailcacher.

 php7-platform:
    environment:
      - PHP_IDE_CONFIG=serverName=localhost
    container_name: php-7.4
    build:
      context: .
      dockerfile: docker/php/7.4/Dockerfile
      cache_from:
        - ./docker/php/7.4/
    depends_on:
      - db
    links:
      - mailcatcher
    networks:
      - default

  # https://hub.docker.com/r/schickling/mailcatcher/
  mailcatcher:
    image: schickling/mailcatcher
    container_name: mailcatcher
    ports:
      - "1025:1025" # changed to 1026 to avoid local instance of mailcatcher
      - "1080:1080"

When I send mails mailtacher is just ignored them and they are being derived on the address.

What I am missing here?


Solution

  • The solution is very simple :)

    https://mailcatcher.me/

    Only msmstp configuration should be updated to work with maicatcher

    account default
    tls off
    auth off
    host mailcatcher
    port 1025
    user ''
    from webserver@webserver.com
    password ''