Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMTP authentication #353

Open
manshurtigh opened this issue Jun 26, 2024 · 5 comments
Open

SMTP authentication #353

manshurtigh opened this issue Jun 26, 2024 · 5 comments
Labels

Comments

@manshurtigh
Copy link

manshurtigh commented Jun 26, 2024

Summary

Email is not sent. Need to specify SMTP authentication.

Steps to reproduce

Configure below:

      - ENABLE_NOTIFICATIONS=TRUE
      - NOTIFICATION_TYPE=EMAIL
      - [email protected]
      - [email protected]
      - SMTP_HOST=smtp.example.se
      - SMTP_PORT=465

What is the expected correct behavior?

All smtp servers expect an authentication.

Environment

  • Image version / tag: 4.1.1
  • Host OS: Unraid

Possible fixes

I don't know if it's not documented or I cannot find it?

@effectivelywild
Copy link
Contributor

To get around this I added a postfix relay that supports authentication and referenced that in my db-backup configuration.

  postfixrelay:
    container_name: postfixrelay
    image: loganmarchione/docker-postfixrelay:latest
    restart: unless-stopped
    environment:
      - TZ=America/Los_Angeles
      - RELAY_HOST=email-smtp.us-east-1.amazonaws.com
      - RELAY_PORT=587
      - RELAY_USER=<USER>
      - RELAY_PASS=<PASS>
    networks:
      - docker-backup
    ports:
      - 25:25
    volumes:
      - postfixrelay_data:/var/spool/postfix

@alwynpan
Copy link
Contributor

I suppose you can mount a msmtp configuration file to /etc/msmtprc.

@manshurtigh
Copy link
Author

To get around this I added a postfix relay that supports authentication and referenced that in my db-backup configuration.

  postfixrelay:
    container_name: postfixrelay
    image: loganmarchione/docker-postfixrelay:latest
    restart: unless-stopped
    environment:
      - TZ=America/Los_Angeles
      - RELAY_HOST=email-smtp.us-east-1.amazonaws.com
      - RELAY_PORT=587
      - RELAY_USER=<USER>
      - RELAY_PASS=<PASS>
    networks:
      - docker-backup
    ports:
      - 25:25
    volumes:
      - postfixrelay_data:/var/spool/postfix

This seems like a great idea. Could you also provide how you specify the postfixrelay container in the configuration for the docker-db-backup?

@effectivelywild
Copy link
Contributor

I included the following environment variables:

      NOTIFICATION_TYPE: EMAIL
      MAIL_FROM: [email protected]
      MAIL_TO: [email protected]
      SMTP_HOST: postfixrelay
      SMTP_PORT: 25

postfixrelay being the name of my postfix container.

@manshurtigh
Copy link
Author

manshurtigh commented Aug 14, 2024

Cheers! I got the postfixrelay container working. Successfully sent a test email. However, if I run a "backup-now" in the docker-db-backup container it does not send an email. I don't even see it trying in the logs of the postfixrelay container.

Below is configured in docker-db-backup

ENABLE_NOTIFICATIONS=true
NOTIFICATION_TYPE=EMAIL

I even get a notice in the log saying:

2024-08-14.21:02:16 [NOTICE] ** [messaging] Container configured to route mail via SMTP to 'postfixrelay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants