[Solved] Mail loops back to myself - probably related to 12.1 upgrade

Hello.

I have two yunohost servers, A and B. Both are very similar and have been configured as explained at Homemade WireGuard VPN on a VPS server.

A runs Yunohost 12.1.4 and B runs Yunohost 12.0.17

Email was working great on both, but now there is a problem on A, perhaps related to the 12.1 upgrade, not sure. Everything is working ok on B.

Emails do not arrive to A users. People sending emails to A users get an “Undelilvered Mail Returned to Sender” email which says that “mail for subdomain.domain-a.tld loops back to myself”.

A users can send emails but they cannot be copied to the Sent folder.

According to Postfix Configuration Parameters the mail-loops-back-to-myself error “happens when the local MTA is the best SMTP mail exchanger for a destination not listed in $mydestination, $inet_interfaces, $proxy_interfaces, $virtual_alias_domains, or $virtual_mailbox_domains.”

I do not properly understand what that means, but I checked those values on servers A and B and noticed one of them was different: virtual_mailbox_domains

On /etc/postfix/main.cf of server A I could find the value
virtual_mailbox_domains = /etc/postfix/virtual-mailbox-domains
while server B had
virtual_mailbox_domains = ldap:/etc/postfix/ldap-domains.cf

I also found A was missing a file B did have: /etc/postfix/ldap-domains.cf

So I modified A so that it had the same parameter and file as B. Then I restarted Postfix and nothing got fixed.

Any suggestion will be a ray of happiness.

In the meantime I’m thinking of a restore, but I have a doubt. If I do a restore from the official Yunohost backup tool, will post-backup email messages stay?

Thank you.

journalctl

Aug 23 03:11:56 postfix/anvil[4473]: statistics: max recipient rate 1/60s for (smtp:178.6.43.74) at Aug 23 03:08:34
Aug 23 03:11:56 postfix/anvil[4473]: statistics: max cache size 1 at Aug 23 03:08:32
Aug 23 03:14:24 postfix/smtpd[4667]: connect from azpdcgyse1k8.stretchoid.com[128.102.103.54]
Aug 23 03:14:24 postfix/smtpd[4667]: improper command pipelining after CONNECT from azpdcgyse1k8.stretchoid.com[128.102.103.54]: MGLNDD_93.90.205.227_25\n
Aug 23 03:14:25 postfix/smtpd[4667]: lost connection after UNKNOWN from azpdcgyse1k8.stretchoid.com[128.102.103.54]
Aug 23 03:14:25 postfix/smtpd[4667]: disconnect from azpdcgyse1k8.stretchoid.com[128.102.103.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: improper command pipelining after CONNECT from unknown[167.94.146.54]: \026\003\003\001\246\001\000\001\242\003\003K\\\341\211\2225C\036\304\322_\275\2444\305\257\252o&\362\324R\035]P\347R|\217\n\323r 3\r\231\205\210\bQ\224^\200\234\345\261;\242\266\200\032\343\223\355\272\030q\341\345\374\210\314\346=\341\000\212\000\026\0003\000g\300\236\300\242\000\236\0009\000k\300\237\300\243\000\237
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\003\001\246\001\000\001\242\003\003K\\\341\211\2225C\036\304\322_\275\2444\305\257\252o&\36
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\003\001\246\001\000\001\242\003\003\021\200b`}\271e\225\214\370B\201\372\347\350=Io\240.\01
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\003\001W\001\000\001S\003\003\334\242\242\v\202`#\321U>\tOC\215\231\270\226\r\233\026\351\3
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\003\001I\001\000\001E\003\003\rE\006-9\032\2507R\r'\345n\036\200\230Am-\260\315-@W2s5J\\\25
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\003\001\232\001\000\001\226\003\003H\214\325\274\034\017\375eW\fH\265)\205)\200\266\333\304
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\002\001\233\001\000\001\227\003\002Vdb2\303\301\267r>\254\200s\213\365`~\372\033\215\2513\2
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:06 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:06 postfix/smtpd[4811]: improper command pipelining after CONNECT from unknown[167.94.146.54]: \026\003\001\001\250\001\000\001\244\003\003\314~\375!\351\234qm\366F\353\177\354J*2\226\201\260\256\213c)\tp\256O\211\027\355\263\\ \235\211Cj\2723k,\311\374\355\246y\000>\306\300\375;\346@M\337\017\327\356\357%O\355\217\337\000\212\000\026\0003\000g\300\236\300\242\000\236\0009\000k\300\237\300\243\000\237
Aug 23 03:16:06 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\001\001\250\001\000\001\244\003\003\314~\375!\351\234qm\366F\353\177\354J*2\226\201\260\256
Aug 23 03:16:06 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:07 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:07 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\001\001\250\001\000\001\244\003\003z\214\275\271\030k\262:^\265\322G_\263\374\033\320iX\375
Aug 23 03:16:07 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:07 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:07 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\001\001\236\001\000\001\232\003\003S\247\245\263\242\266!\031o\265\366S\225\002\344\3628\27
Aug 23 03:16:07 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:16:07 postfix/smtpd[4811]: connect from unknown[167.94.146.54]
Aug 23 03:16:07 postfix/smtpd[4811]: improper command pipelining after CONNECT from unknown[167.94.146.54]: \026\003\001\001\265\001\000\001\261\003\003\205\207_\b\304\254X\327u\323\251\322\312\034\255`_*\3532\247m\334E\204\006\006\312Be'\n Y>f\276|"\260\351\021Ye'\202\232\006\017\255\023\234\031\240h\305n \317\203\307\206\331\230\267\000\214\312\312\300\022\300\023\300\a\300'\314\024\300/\023\001\300\024\023\002\300(
Aug 23 03:16:07 postfix/smtpd[4811]: warning: non-SMTP command from unknown[167.94.146.54]: \026\003\001\001\265\001\000\001\261\003\003\205\207_\b\304\254X\327u\323\251\322\312\034\255`_*\353
Aug 23 03:16:07 postfix/smtpd[4811]: disconnect from unknown[167.94.146.54] unknown=0/1 commands=0/1
Aug 23 03:19:27 postfix/anvil[4669]: statistics: max connection rate 10/60s for (smtp:167.94.146.54) at Aug 23 03:16:07
Aug 23 03:19:27 postfix/anvil[4669]: statistics: max connection count 1 for (smtp:128.102.103.54) at Aug 23 03:14:24
Aug 23 03:19:27 postfix/anvil[4669]: statistics: max cache size 1 at Aug 23 03:14:24
Aug 23 04:01:54 postfix/smtpd[5824]: connect from b5.scanner.modat.io[46.4.60.80]
Aug 23 04:01:54 postfix/smtpd[5824]: improper command pipelining after CONNECT from b5.scanner.modat.io[46.4.60.80]: \026\003\001\000\356\001\000\000\352\003\003\230\t\300\264\031~\212\\<\260\301\313\253\263~\032\231\253sa\221\032\261\2371\346\270\002w\0277f b\325\274[\365\336\360v\203W\027\335\017\235H\3548V\034,\276\036\3443\233\325\267\347\253\303{\342\000&\314\250\314\251\300/\3000\300+\300,\300\023\300\t\300\024\300\n\000\234
Aug 23 04:01:54 postfix/smtpd[5824]: warning: non-SMTP command from b5.scanner.modat.io[46.4.60.80]: \026\003\001\000\356\001\000\000\352\003\003\230\t\300\264\031~\212\\<\260\301\313\253\263~\032\231\
Aug 23 04:01:54 postfix/smtpd[5824]: disconnect from b5.scanner.modat.io[46.4.60.80] unknown=0/1 commands=0/1
Aug 23 04:05:14 postfix/anvil[5829]: statistics: max connection rate 1/60s for (smtp:46.4.60.80) at Aug 23 04:01:54
Aug 23 04:05:14 postfix/anvil[5829]: statistics: max connection count 1 for (smtp:46.4.60.80) at Aug 23 04:01:54
Aug 23 04:05:14 postfix/anvil[5829]: statistics: max cache size 1 at Aug 23 04:01:54

var/log/mail.log

2025-08-23T04:23:49.460880+02:00 subdomain dovecot: imap(alice)<6348><IsRAA/88/L+q/Thb>: Error: Failed to get quota resource STORAGE: quota-maildir: Failed to get STORAGE_BYTES: open(/var/mail/alice/maildirsize) failed: Not a directory
2025-08-23T04:23:49.526894+02:00 subdomain dovecot: imap(alice)<6347><r1ZAA/889L+q/Thb>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:23:49.559667+02:00 subdomain dovecot: imap(alice)<6348><IsRAA/88/L+q/Thb>: Error: Failed to get quota resource STORAGE: quota-maildir: Failed to get STORAGE_BYTES: open(/var/mail/alice/maildirsize) failed: Not a directory
2025-08-23T04:23:49.620771+02:00 subdomain dovecot: imap(alice)<6347><r1ZAA/889L+q/Thb>: Error: stat(/var/mail/alice/.DeltaChat/tmp) failed: Not a directory
2025-08-23T04:23:49.649856+02:00 subdomain dovecot: imap(alice)<6348><IsRAA/88/L+q/Thb>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:49.716159+02:00 subdomain dovecot: imap(alice)<6347><r1ZAA/889L+q/Thb>: Disconnected: Connection closed (SELECT finished 0.094 secs ago) in=152 out=1355 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2025-08-23T04:23:49.744180+02:00 subdomain dovecot: imap(alice)<6348><IsRAA/88/L+q/Thb>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:23:49.838671+02:00 subdomain dovecot: imap(alice)<6348><IsRAA/88/L+q/Thb>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:49.933735+02:00 subdomain dovecot: imap(alice)<6348><IsRAA/88/L+q/Thb>: Disconnected: Connection closed (SELECT finished 0.094 secs ago) in=200 out=1485 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2025-08-23T04:23:56.774715+02:00 subdomain dovecot: imap-login: Login: user=<alice>, method=PLAIN, rip=31.110.137.8, lip=10.9.02, mpid=6352, TLS, session=<8bm0A/88HBEf3fh3>
2025-08-23T04:23:56.776839+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: chdir(/var/mail/alice) failed: Not a directory
2025-08-23T04:23:57.219190+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: Failed to get quota resource STORAGE: quota-maildir: Failed to get STORAGE_BYTES: open(/var/mail/alice/maildirsize) failed: Not a directory
2025-08-23T04:23:57.362741+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: Failed to get quota resource STORAGE: quota-maildir: Failed to get STORAGE_BYTES: open(/var/mail/alice/maildirsize) failed: Not a directory
2025-08-23T04:23:57.493081+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:57.888421+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:23:58.019684+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/.Junk/tmp) failed: Not a directory
2025-08-23T04:23:58.151920+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/.Sent/tmp) failed: Not a directory
2025-08-23T04:23:58.287956+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/.Archive/tmp) failed: Not a directory
2025-08-23T04:23:58.424111+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:58.588086+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:58.720719+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:58.849924+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:23:58.982374+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:23:59.117810+02:00 subdomain dovecot: imap(alice)<6352><8bm0A/88HBEf3fh3>: Disconnected: Connection closed (SELECT finished 0.135 secs ago) in=421 out=2577 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2025-08-23T04:24:49.122030+02:00 subdomain dovecot: imap-login: Login: user=<alice>, method=PLAIN, rip=170.142.45.80, lip=10.9.02, mpid=6359, TLS, session=<DXvTBv88BM+q/Thb>
2025-08-23T04:24:49.124122+02:00 subdomain dovecot: imap(alice)<6359><DXvTBv88BM+q/Thb>: Error: chdir(/var/mail/alice) failed: Not a directory
2025-08-23T04:24:49.146308+02:00 subdomain dovecot: imap-login: Login: user=<alice>, method=PLAIN, rip=170.142.45.80, lip=10.9.02, mpid=6360, TLS, session=<2dnTBv88CM+q/Thb>
2025-08-23T04:24:49.149462+02:00 subdomain dovecot: imap(alice)<6360><2dnTBv88CM+q/Thb>: Error: chdir(/var/mail/alice) failed: Not a directory
2025-08-23T04:24:49.383667+02:00 subdomain dovecot: imap(alice)<6359><DXvTBv88BM+q/Thb>: Error: stat(/var/mail/alice/.DeltaChat/tmp) failed: Not a directory
2025-08-23T04:24:49.409099+02:00 subdomain dovecot: imap(alice)<6360><2dnTBv88CM+q/Thb>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:24:49.469268+02:00 subdomain dovecot: imap(alice)<6359><DXvTBv88BM+q/Thb>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:24:49.496178+02:00 subdomain dovecot: imap(alice)<6360><2dnTBv88CM+q/Thb>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:24:49.555154+02:00 subdomain dovecot: imap(alice)<6359><DXvTBv88BM+q/Thb>: Error: stat(/var/mail/alice/.DeltaChat/tmp) failed: Not a directory
2025-08-23T04:24:49.582623+02:00 subdomain dovecot: imap(alice)<6360><2dnTBv88CM+q/Thb>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:24:49.642365+02:00 subdomain dovecot: imap(alice)<6359><DXvTBv88BM+q/Thb>: Disconnected: Connection closed (SELECT finished 0.086 secs ago) in=152 out=1355 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2025-08-23T04:24:49.668477+02:00 subdomain dovecot: imap(alice)<6360><2dnTBv88CM+q/Thb>: Disconnected: Connection closed (SELECT finished 0.085 secs ago) in=140 out=1355 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2025-08-23T04:25:49.121219+02:00 subdomain dovecot: imap-login: Login: user=<alice>, method=PLAIN, rip=170.142.45.80, lip=10.9.02, mpid=6375, TLS, session=<sABnCv88+r+q/Thb>
2025-08-23T04:25:49.123417+02:00 subdomain dovecot: imap(alice)<6375><sABnCv88+r+q/Thb>: Error: chdir(/var/mail/alice) failed: Not a directory
2025-08-23T04:25:49.144711+02:00 subdomain dovecot: imap-login: Login: user=<alice>, method=PLAIN, rip=170.142.45.80, lip=10.9.02, mpid=6376, TLS, session=<ZlpnCv88CMCq/Thb>
2025-08-23T04:25:49.147107+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Error: chdir(/var/mail/alice) failed: Not a directory
2025-08-23T04:25:49.383090+02:00 subdomain dovecot: imap(alice)<6375><sABnCv88+r+q/Thb>: Error: stat(/var/mail/alice/.DeltaChat/tmp) failed: Not a directory
2025-08-23T04:25:49.406053+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Error: Failed to get quota resource STORAGE: quota-maildir: Failed to get STORAGE_BYTES: open(/var/mail/alice/maildirsize) failed: Not a directory
2025-08-23T04:25:49.468652+02:00 subdomain dovecot: imap(alice)<6375><sABnCv88+r+q/Thb>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:25:49.493034+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Error: Failed to get quota resource STORAGE: quota-maildir: Failed to get STORAGE_BYTES: open(/var/mail/alice/maildirsize) failed: Not a directory
2025-08-23T04:25:49.554927+02:00 subdomain dovecot: imap(alice)<6375><sABnCv88+r+q/Thb>: Error: stat(/var/mail/alice/.DeltaChat/tmp) failed: Not a directory
2025-08-23T04:25:49.578702+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:25:49.642098+02:00 subdomain dovecot: imap(alice)<6375><sABnCv88+r+q/Thb>: Disconnected: Connection closed (SELECT finished 0.086 secs ago) in=152 out=1355 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2025-08-23T04:25:49.664965+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Error: Root directory is a file: /var/mail/alice
2025-08-23T04:25:49.751040+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Error: stat(/var/mail/alice/tmp) failed: Not a directory
2025-08-23T04:25:49.837093+02:00 subdomain dovecot: imap(alice)<6376><ZlpnCv88CMCq/Thb>: Disconnected: Connection closed (SELECT finished 0.086 secs ago) in=200 out=1485 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0```

I found this weird thing:

root@subdomain:~# cd /var/mail
root@subdomain:/var/mail# ls -hal | grep alice
drwx--S--- 39 vmail mail 4.0K Aug 22 21:19 BOGUS.alice.f4A5
-rw-rw----  1 alice mail  23K Aug 22 23:57 alice

The rest of the users look normal, they do not have that weird thing:

root@subdomain:/var/mail# ls -hal
total 80K
drwxrwsr-t 13 root  mail 4.0K Aug 22 23:57 .
drwxr-xr-x 13 root  root 4.0K May 26  2024 ..
drwx--S---  5 vmail mail 4.0K Nov 18  2024 bob
drwx--S--- 39 vmail mail 4.0K Aug 22 21:19 BOGUS.alice.f4A5
drwx--S---  2 vmail mail 4.0K Oct  1  2022 carol
drwx--S---  5 vmail mail 4.0K Aug 12  2023 denis
-rw-rw----  1 alice mail  23K Aug 22 23:57 alice

However, no user is receiving any message. When people try to send messages to the rest of the users, they get the same “Undelivered Mail Returned to Sender” message as when sending to alice. The message they get is from MAILER-DAEMON@subdomain.domain-a.tld and it reads:

This is the mail system at host subdomain.domain-a.tld

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<bob@subdomain.domain-a.tld> (expanded from <bob@domain-a.tld>): mail
    for subdomain.domain-a.tld loops back to myself

---

Reporting-MTA: dns; subdomain.domain-a.tld
X-Postfix-Queue-ID: 4A2C3E21779
X-Postfix-Sender: rfc822; SRS0=s+WX=3E=senderdomain.tld=senderuser@subdomain.domain-a.tld
Arrival-Date: Sun, 24 Aug 2025 17:18:26 +0200 (CEST)

Final-Recipient: rfc822; bob@subdomain.domain-a.tld
Original-Recipient: rfc822;bob@domain-a.tld
Action: failed
Status: 5.4.6
Diagnostic-Code: X-Postfix; mail for subdomain.domain-a.tld loops back to
    myself

There is a postfix migration in the last update. So in case you made some customisations to your postfix config, then you should probably run yunohost tools regen-conf --dry-run --with-diff to see what’s going to be updated then run the migration yunohost tools regen-conf --force then reapply your customisations.

Hey, thank you for showing up!

As far as am aware, I have not done any customization.

Please see the output of yunohost tools regen-conf --dry-run --with-diff at the pastebin and please let me know your suggestion. Thank you.

So you probably should run yunohost tools regen-conf --force to reset the configuration files. You may have to reapply the vpn configuration afterwards.

I run the command. Then I did a reboot. But it did not fix it.

The VPN configuration stayed there, but the mail problem as well.

People on the Internet sending emails to yunohost users keep receiving the “Undelivered Mail Returned to Sender” message from MAILER-DAEMON@subdomain.domain-a.tld that reads:

This is the mail system at host subdomain.domain-a.tld

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<alice@subdomain.domain-a.tld> (expanded from <alice@domain-a.tld>): mail
    for subdomain.domain-a.tld loops back to myself

---

Reporting-MTA: dns; subdomain.domain-a.tld
X-Postfix-Queue-ID: 4A2C3E21779
X-Postfix-Sender: rfc822; SRS0=s+WX=3E=senderdomain.tld=senderuser@subdomain.domain-a.tld
Arrival-Date: Sun, 24 Aug 2025 17:18:26 +0200 (CEST)

Final-Recipient: rfc822; alice@subdomain.domain-a.tld
Original-Recipient: rfc822;alice@domain-a.tld
Action: failed
Status: 5.4.6
Diagnostic-Code: X-Postfix; mail for subdomain.domain-a.tld loops back to
    myself

Please let me know if I should provide the output of any command or log

Can you share the content of /etc/hosts?

Sure, there you go.

127.0.0.1       localhost
127.0.0.1       subdomain.domain-a.tld subdomain domain-a.tld berenjenal
127.0.0.1       muc.domain-a.tld
127.0.0.1       xmpp-upload.domain-a.tld

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback domain-a.tld
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
::1     muc.domain-a.tld
cat /etc/hosts
127.0.0.1       localhost
::1     localhost       ip6-localhost   ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.1.1       domain.com       domain

This is mine, although I have multiple other domains and subdomains. You can try commenting some of the extra lines

I tried. The problem is still there : (

You confirm that yunohost tools regen-conf --dry-run --with-diff gives empty output?
Try disabling the vpn then make a test?

Thank YunoGod it is finally fixed, I was pulling my hair out.

It was just a couple of easy things (I do not see any relationship between them) but, as they were happening at the same time, it looked very confusing.

I noticed the contents of my /etc/postfix/virtual-mailbox-domains file did not include my subdomain, only the domain. I just included the subdomain by enabling email for that subdomain on the domains section of the webadmin interface. That fixed the mail-loop-back-to-myself problem.

Then users started to receive incoming email. All but alice. But once email was working for everyone, alice’s problem was easy to solve.

root@subdomain:~# cd /var/mail
root@subdomain:/var/mail# ls -hal | grep alice
drwx--S--- 39 vmail mail 4.0K Aug 22 21:19 BOGUS.alice.f4A5
-rw-rw----  1 alice mail  23K Aug 22 23:57 alice
root@subdomain:/var/mail#
root@subdomain:/var/mail# mkdir -p /root/alice-just-in-case-backup
root@subdomain:/var/mail# cp -a /var/mail/alice /var/mail/BOGUS.alice.f4A5 /root/alice-just-in-case-backup/
root@subdomain:/var/mail# rm alice
root@subsomain:/mai/mail# mv BOGUS.alice.f4A5 alice
root@subsomain:/mai/mail# systemctl restart dovecot

Thank you very much @jarod5001 and @rodinux for your help!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.