Emails not working with docker

Checklist
I have read intro post: About the Installation Issues category
I have read the tutorials, help and searched for similar issues
I provide relevant information about my server (component names and versions, etc.)
I provide a copy of my logs and healthcheck
I describe the steps I have taken to trouble shoot the problem
I describe the steps on how to reproduce the issue

Hi I have deployed passbolt using docker and have followed the instructions in the documentation.
My server config:

  • Docker version 23.0.4
  • Ubuntu 22.10
  • Vendor: Digital Ocean
  • SMTP: Sendgrid

My docker compose file:

version: "3.9"
services:
  db:
    image: mariadb:10.11
    restart: unless-stopped
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "true"
      MYSQL_DATABASE: "passbolt"
      MYSQL_USER: "passbolt"
      MYSQL_PASSWORD: "password"
    volumes:
      - database_volume:/var/lib/mysql

  passbolt:
    image: passbolt/passbolt:4.2.0-1-ce
    #Alternatively you can use rootless:
    #image: passbolt/passbolt:latest-ce-non-root
    restart: unless-stopped
    depends_on:
      - db
    environment:
      APP_FULL_BASE_URL: https://passbolt.example.dev
      DATASOURCES_DEFAULT_HOST: "db"
      DATASOURCES_DEFAULT_USERNAME: "passbolt"
      DATASOURCES_DEFAULT_PASSWORD: "password"
      DATASOURCES_DEFAULT_DATABASE: "passbolt"
      EMAIL_DEFAULT_FROM: "passbolt@example.dev"
      EMAIL_TRANSPORT_DEFAULT_HOST: "smtp.sendgrid.net"
      EMAIL_TRANSPORT_DEFAULT_PORT: 587
      EMAIL_TRANSPORT_DEFAULT_USERNAME: "my_key"
      EMAIL_TRANSPORT_DEFAULT_PASSWORD: "my_password"
      EMAIL_TRANSPORT_DEFAULT_TLS: "true"
    volumes:
      - gpg_volume:/etc/passbolt/gpg
      - jwt_volume:/etc/passbolt/jwt
    command:
      [
        "/usr/bin/wait-for.sh",
        "-t",
        "0",
        "db:3306",
        "--",
        "/docker-entrypoint.sh",
      ]
    ports:
      - 2345:80
      - 2346:443

volumes:
  database_volume:
  gpg_volume:
  jwt_volume:

When i open the UI and try to send a test email the output is this:
The test email could not be sent. Kindly check the logs below for more information.

[
    {
        "cmd": null,
        "response": [
            {
                "code": "220",
                "message": "SG ESMTP service ready at geopod-ismtpd-7"
            }
        ]
    },
    {
        "cmd": "EHLO passbolt.syedharis.dev",
        "response": [
            {
                "code": "250",
                "message": "smtp.sendgrid.net"
            },
            {
                "code": "250",
                "message": "8BITMIME"
            },
            {
                "code": "250",
                "message": "PIPELINING"
            },
            {
                "code": "250",
                "message": "SIZE 31457280"
            },
            {
                "code": "250",
                "message": "STARTTLS"
            },
            {
                "code": "250",
                "message": "AUTH PLAIN LOGIN"
            },
            {
                "code": "250",
                "message": "AUTH=PLAIN LOGIN"
            }
        ]
    },
    {
        "cmd": "STARTTLS",
        "response": [
            {
                "code": "220",
                "message": "Begin TLS negotiation now"
            }
        ]
    }
]

These logs don’t seem to give a lot of information. I have verified the configuration and the SMTP server seems to be working fine. What could i do to solve this?

Hello @haris-syed,

It looks like the process seems to fail after starting TLS.

Before anything else, could you ensure that the smtp credentials are correct? Are you using the API key as mentionned here ?

Although it’s not recommended for production, could you try to temporarily disable TLS to see if that allows email to be sent? To be sure if the issue is specifically related to TLS.

Finally, could you try to check the sendgrid activity logs?

Hi antony thanks for your help. I have solved this issue. The problem was that if we select “Sendgrid” from the settings menu in passbolt it autofills the smtp host to be “smtp.sendgrid.com” whereas the actual smtp host for sendgrid is “smtp.sendgrid.net”. Adding this manually has fixed the problem.

Thanks for sharing this with us. I have created an internal ticket for this issue (ref. PB-28170)

Hello @haris-syed ,

I wanted to let you know that we have fixed the smtp host for sendgrid (see. PB-28170 Fix SMTP host from Sendgrid)

Thanks for your help!

1 Like