Skip to content

[BUG] sendmail (msmtp) ignores msmtprc in /config and connects to 127.0.0.1 #528

@syprix

Description

@syprix

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Environment

  • Unraid Version: (32.0.0.13 + 31.0.0.1)
  • Docker Image: lscr.io/linuxserver/nextcloud:previous

Current Behavior

The sendmail command (which is msmtp) inside the container ignores the user-provided configuration file at /config/msmtp/msmtprc. Instead of connecting to the external SMTP host defined in the file, it tries to connect to 127.0.0.1 and fails.

Steps to Reproduce

  1. Create a valid msmtprc file at /config/msmtp/msmtprc with external SMTP details.
  2. Set correct ownership (chown 99:100) and permissions (chmod 600).
  3. Exec into the container as user abc.
  4. Run a test send: echo "Test" | sendmail my-test@email.com.
  5. The command fails with the error: sendmail: can't connect to remote host (127.0.0.1): Connection refused.

Additional Context

A curl test from within the same container shell works perfectly and authenticates successfully with the external SMTP server (curl -v smtps://...). This proves that the container's networking, DNS, and the user's credentials are all correct. The problem is specific to msmtp not reading its configuration from the /config volume.

Expected Behavior

The sendmail (msmtp) command should read its configuration from the /config/msmtp/msmtprc file and connect to the external SMTP host defined there.

Steps To Reproduce

Steps To Reproduce:

  1. Create a valid msmtprc file at /config/msmtp/msmtprc with external SMTP details.
  2. Set correct ownership (chown 99:100) and permissions (chmod 600).
  3. Exec into the container as user abc.
  4. Run a test send: echo "Test" | sendmail my-test@email.com.
  5. See the error: sendmail: can't connect to remote host (127.0.0.1): Connection refused.

Current Behavior:
The sendmail (msmtp) command fails to connect to the external host and tries to connect to 127.0.0.1 instead, ignoring the configuration file.

Expected Behavior:
The sendmail command should read the configuration from /config/msmtp/msmtprc and connect to the external SMTP host.

Additional Context / Proof:
A curl test from within the same container shell works perfectly and authenticates successfully with the same external SMTP server. This proves the container's networking, DNS, and credentials are correct. The problem is specific to msmtp not reading its configuration from the /config volume.

Environment

- OS: Unraid OS (Ihre Version hier eintragen)
- How docker service was installed: Docker is a built-in service managed by the Unraid OS GUI.
- Docker Image: `lscr.io/linuxserver/nextcloud:previous` (containing Nextcloud Version `31.0.0.1`)

CPU architecture

x86-64

Docker creation

- Unraid GUI was used for creation.
- Repository: lscr.io/linuxserver/nextcloud:previous
- Port Mapping: 4443 -> 443 (TCP)
- Host Path for /config: /mnt/user/appdata/nextcloud
- Host Path for /data: /mnt/user/Nextcloud
- PUID: 99
- PGID: 100

Container logs

[migrations] started
[migrations] 01-nginx-site-confs-default: executing...
[migrations] 01-nginx-site-confs-default: succeeded
[migrations] 02-default-location: executing...
[migrations] 02-default-location: succeeded
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    99
User GID:    100
───────────────────────────────────────
Linuxserver.io version: 31.0.9-ls60
Build-date: 2025-09-27T08:43:07+00:00
───────────────────────────────────────

Setting resolver to  8.8.8.8 8.8.4.4 208.67.222.222
Setting worker_processes to 38
generating self-signed keys in /config/keys, you can replace these with your own keys if required
.+...+...+.+......+..+......+............+.......+......+.........+..+++++++++++++++++++++++++++++++++++++++*....+......+.+...+......+........+...+..........+.....+...+++++++++++++++++++++++++++++++++++++++*..........................+...+..+.+.....+....+.....+......+.+......+.....+...+.+...+...........+.+.........+.....+....+......+..+.........+..........+...........+...+.+......+.................+.+.........+..+...+...+...+.++++++
.........+++++++++++++++++++++++++++++++++++++++*.+..+++++++++++++++++++++++++++++++++++++++*..+..+.+............+.....+.+..+...........................+...+.......+...........+.+......+..+......+.+...+...............+...+........+............+....+.........+..+...+.......+..+...+.......+...+.........+......+.....+...+............+....+...+......+.........+..+...+.+...........+.........+.........+.......+......+...............+.....+.......+..+......+...+.+......+.....+..........+..+.+.........+.....+...+....+...............+...+.....+......+......+..........+...+.....+...+.......+..+......+.............+...........+....+..+..................+....+...+..+.............+..+.......+..............+......+.+...+...........+.+...+..+.............+..+.......+......+..+...+...............+.........+..........+...+.....+..........+.....+...+....+...+..+.+.........+.....+.+......+........+...+....+........+.............+..+.+......+........+.............+...+..+.........+.+.........+...............+......+........+....+......+.....+.....................+.+........+....+..+....+.....+......+..........+...+..+......+....+........+...+.......+......+......+.....+...+.............+.........+.....+.+...+.....+......+.+...+.........+........+.......+...........+.+...+...+.........+......+..............+......+...+......+....+..............+..........+..+...+...+............+.......+.....+...+.+............+...+..+.......+.....................+.....+....+......+..+............+...+....+......+..+...+...+......+....++++++
-----
Initializing nextcloud 31.0.9.1 (this can take a while) ...
Setting permissions
New nextcloud instance
Please run the web-based installer on first connect!
Initializing finished
After completing the web-based installer, restart the Nextcloud container to apply default memory caching and transactional file locking configurations.
Alternatively, you can apply your own configurations by editing /config/www/nextcloud/config/config.php following the documentation:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html
https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/files_locking_transactional.html
[custom-init] No custom files found, skipping...
[ls.io-init] done.
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
Exception: Not installed in /app/www/public/lib/base.php:229
Stack trace:
#0 /app/www/public/lib/base.php(694): OC::checkInstalled()
#1 /app/www/public/lib/base.php(1194): OC::init()
#2 /app/www/public/cron.php(24): require_once('...')
#3 {main}
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
usermod: no changes
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    99
User GID:    100
───────────────────────────────────────
Linuxserver.io version: 31.0.9-ls60
Build-date: 2025-09-27T08:43:07+00:00
───────────────────────────────────────

using keys found in /config/keys
System config value filelocking.enabled set to boolean true
System config value upgrade.disable-web set to boolean true
[custom-init] No custom files found, skipping...
[ls.io-init] done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions