getfider / fider

Open platform to collect and prioritize feedback
https://fider.io
GNU Affero General Public License v3.0
2.75k stars 620 forks source link

Using local sendmail #1151

Closed alcalyn closed 8 months ago

alcalyn commented 8 months ago

In other program, I use sendmail to send application emails, which I can configure with something like:

MAILER_DSN=sendmail://default

Is there a way to use a locally installed sendmail instead of an smtp server ?

alcalyn commented 8 months ago

Ok, sendmail is also an smtp server.

I could configure the app inside docker to connect to its host, and configure sendmail to accept connection from other ips than loopback.

In docker-compose.yml:

  app:
    image: getfider/fider:stable

    # add a reference to the host ip:
    extra_hosts:
      - host.docker.internal:host-gateway

    environment:
      # use this EMAIL config:
      EMAIL_SMTP_HOST: host.docker.internal
      EMAIL_SMTP_PORT: 25

And for sendmail, I had to remove the Addr=127.0.0.1 in /etc/mail/sendmail.*, and uncomment in /etc/mail/access:

Connect:172.16                  RELAY
Connect:172.17                  RELAY
Connect:172.18                  RELAY
Connect:172.19                  RELAY
Connect:172.20                  RELAY
Connect:172.21                  RELAY
Connect:172.22                  RELAY
Connect:172.23                  RELAY
Connect:172.24                  RELAY
Connect:172.25                  RELAY
Connect:172.26                  RELAY
Connect:172.27                  RELAY
Connect:172.28                  RELAY
Connect:172.29                  RELAY
Connect:172.30                  RELAY
Connect:172.31                  RELAY

Then service restart sendmail.