strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.17k stars 445 forks source link

Sendmail is not working with docker #199

Closed jeremy-marcillaud closed 4 years ago

jeremy-marcillaud commented 4 years ago

Hello,

I'm using docker with strapi.

I'm in development mode and the sendmail feature from Strapi is not working....

Strapi doesn't send an email if a User register or forget his password...

Here is my docker-compose.yml file.

version: "3"

services:
  strapi:
    container_name: strapi
    image: strapi/strapi:3.0.0-beta.18.3-node12
    ports:
      - 1337:1337
    networks:
      - dev
    volumes:
      - ./:/app:delegated
      - node_modules:/app/node_modules
    working_dir: /app
    env_file:
      - .env
    depends_on:
      - db
    command: sh -c 'npm install && npm run develop'

  db:
    container_name: mariadb
    image: mariadb
    restart: always
    command:
      [
        "--default-authentication-plugin=mysql_native_password",
        "--character-set-server=utf8mb4",
        "--collation-server=utf8mb4_unicode_ci",
      ]
    volumes:
      - ./db:/var/lib/mariadb
      - ./config/init.sql:/docker-entrypoint-initdb.d/init.sql
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    ports:
      - "3308:3306"
    networks:
      - dev
networks:
  dev:
    driver: bridge
volumes:
  node_modules:
alexandrebodin commented 4 years ago

Hi, sendmail is not setup in the default docker images we provide. If you really need to setup sendmail with docker you will have to do it with a custom docker image.

You can extend the strapi:base image to do so.

jeremy-marcillaud commented 4 years ago

Thanks Alexandre for your answer. Could you help me by giving me an example of the setup? If it's too complicated I understand.

alexandrebodin commented 4 years ago

You can start from this example custom image first.

To add the sendmail config and set it up I honestly would just send you google links. I think you are better of looking and learning on your own.

A simpler alternative is to use en email provider instead of sendmail (much simpler to setup and doesn't have issues with spam / phishing and other tricky email stuff)

jeremy-marcillaud commented 4 years ago

Perfect I've tried with sendgrid and it's working. I'll stick with it. Thanks a lot for your help!

alexandrebodin commented 4 years ago

Great ! Have a good time with Strapi !