0

I am having a connection issue to Mailtrap from my PHP instance. I currently have such in my docker-compose.yml

version: "3.4"

services:
  php:
    build:
      context : ./
      dockerfile : Dockerfile
      network: host

    ports:
        - "9000:9000"
    expose:
      - "9000"

  mail:
    container_name: sys_mail
    restart: unless-stopped
    image: eaudeweb/mailtrap:latest
    ports:
      - "127.0.0.1:8125:80"
      - "127.0.0.1:2525:25"
    environment:
      - MT_USER=mailtrap
      - MT_PASSWD=mailtrap
      - MT_MAILBOX_LIMIT=512000001
      - MT_MESSAGE_LIMIT=102400001

I am able to connect on local to to mailtrap via 127.0.0.1:8125, I am also able to connect via telnet as such: telnet localhost 2525

But I am unable to connect and send email via smtp from my php container. My apps SMTP configuration is as such:

host: mail
login: mailtrap
password: mailtrap
port: 2525

The error is SMTP connect() failed.

What might be doing wrong in this setup?

Devin Dixon
  • 11,553
  • 24
  • 86
  • 167

0 Answers0