crazy-max / docker-msmtpd

Lightweight SMTP relay Docker image using msmtpd
MIT License
80 stars 8 forks source link

msmtp: account default not found: no configuration file available #41

Closed stoically closed 2 years ago

stoically commented 2 years ago

Behaviour

Steps to reproduce this issue

  1. Start docker container
  2. Try to send an email

Expected behaviour

Sending E-Mail works.

Actual behaviour

Sending E-Mail fails and the log reports

msmtp: account default not found: no configuration file available

Checking msmtp --version reports

msmtp version 1.8.19 Platform: x86_64-alpine-linux-musl System configuration file name: /usr/etc/msmtprc User configuration file name: /root/.msmtprc

But the docker-msmtpd init files create the config at /etc/msmtprc.

Workaround: docker exec <container-name> bash -c "ln -s /etc/msmtprc /usr/etc/msmtprc"

Configuration

        env:
          TZ: "Europe/Berlin"
          SMTP_HOST: "{{ mailcow_smtp_host }}"
          SMTP_PORT: "{{ mailcow_smtp_port | string }}"
          SMTP_STARTTLS: "on"
          SMTP_TLS: "on"
          SMTP_AUTH: "on"
          SMTP_USER: "{{ mailcow_username }}"
          SMTP_PASSWORD: "{{ mailcow_password }}"
          SMTP_FROM: "noreply@{{ main_domain }}"
          SMTP_TLS_CHECKCERT: "off"

Logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-fix-logs.sh: executing... 
[cont-init.d] 00-fix-logs.sh: exited 0.
[cont-init.d] 01-fix-uidgid.sh: executing... 
[cont-init.d] 01-fix-uidgid.sh: exited 0.
[cont-init.d] 02-config.sh: executing... 
Setting timezone to Europe/Berlin...
Creating configuration...
[cont-init.d] 02-config.sh: exited 0.
[cont-init.d] 03-create-service.sh: executing... 
[cont-init.d] 03-create-service.sh: exited 0.
[cont-init.d] ~-socklog: executing... 
[cont-init.d] ~-socklog: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
msmtp: account default not found: no configuration file available

Thanks for your work on this!

crazy-max commented 2 years ago

@stoically Should be fixed now

stoically commented 2 years ago

@crazy-max Still broken. mstmp does not read the configuration from /etc/msmtprc in my case, but from /usr/etc/msmtprc, where no configuration is available.

crazy-max commented 2 years ago

@stoically What's the output of msmtp --version inside the container? Should show:

msmtp version 1.8.19
Platform: x86_64-alpine-linux-musl
TLS/SSL library: GnuTLS
Authentication library: GNU SASL; oauthbearer and xoauth2: built-in
Supported authentication methods:
plain scram-sha-1 external gssapi cram-md5 digest-md5 login oauthbearer xoauth2 
IDN support: enabled
NLS: enabled, LOCALEDIR is /usr/share/locale
Keyring support: Gnome 
System configuration file name: /etc/msmtprc
User configuration file name: /root/.msmtprc

Copyright (C) 2021 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
stoically commented 2 years ago

Huh, interesting. Seems to work fine now. Maybe I didn't pull the container properly. Thanks!