# 📬 Repeated Postfix warnings and connections after valid\_recipients implementation

**URL:** https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427
**Category:** Support
**Tags:** mail-receiver
**Created:** [July 23, 2025, 12:51pm UTC](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427 "2025-07-23T12:51:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [July 23, 2025, 12:51pm UTC](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427/1 "2025-07-23T12:51:28Z")

</div>

Continuing the discussion from [Email receive issue](https://meta.discourse.org/t/email-receive-issue/374615/25):

I implemented `valid_recipients` filtering via `postfix/valid_recipients` and populated `/etc/postfix/valid_recipients`. Since then, I’m seeing repeated warnings and inbound connection attempts every ~6 minutes. Here’s a sanitized segment of my log.

* * *

### ⚠ **Exact log output**

```plaintext
Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: warning: /etc/postfix/valid_recipients, line 1: expected format: key whitespace value -- ignoring this line
Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: warning: /etc/postfix/valid_recipients, line 2: expected format: key whitespace value -- ignoring this line
...
Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: warning: /etc/postfix/valid_recipients, line 16: expected format: key whitespace value -- ignoring this line

```

These warnings appear **every few minutes** , aligned with repeated unauthenticated connection attempts like:

```plaintext
Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: warning: hostname unassigned.quadranet.com does not resolve to address 198.55.98.3
Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: connect from unknown[198.55.98.3]
Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: disconnect from unknown[198.55.98.3] ehlo=1 auth=0/1 quit=1 commands=2/3

```

This same pattern repeats from `198.55.98.3` over dozens of cycles throughout the hour.

* * *

### ✅ Legitimate mail passes through

Just to confirm, legitimate deliveries (e.g. from Microsoft 365) are working:

```plaintext
Jul 23 05:46:53 ubuntu-mail-receiver postfix/smtpd[2290]: connect from mail-uksouthazon11020141.outbound.protection.outlook.com[52.101.196.141]
Jul 23 05:46:54 opendkim[25]: D3D4A1BF983: DKIM verification successful
Jul 23 05:46:54 opendmarc[40]: D3D4A1BF983: MYDOMAINNAME.com pass
Jul 23 05:46:54 ubuntu-mail-receiver postfix/pipe[2296]: to=<person.REDACTED@discourse.MYDOMAINNAME.com>, relay=discourse, status=sent (delivered via discourse service)

```

* * *

### ❓Questions

1. Are the `/etc/postfix/valid_recipients` warnings responsible for triggering the repeated connections?
2. Should I expect Postfix to loop on these entries if the file is misformatted?
3. Would you recommend temporarily disabling `check_recipient_access` to test stability?
4. Is there a preferred example of a `valid_recipients` file used with the `mail-receiver` container for Discourse?

* * *

🧩 My `main.cf` line (for reference)

```plaintext
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/valid_recipients, reject

```

Would really appreciate some guidance here — thanks in advance!

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [July 23, 2025, 1:42pm UTC](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427/2 "2025-07-23T13:42:26Z")

</div>

> **How to Reload Postfix with Discourse
AI**
>
> **Ethsim2:**
> 
> > [@open\_mailbox\_with\_raised\_flag Repeated Postfix warnings and connections after valid\_recipients implementation](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427):
> >
> > Continuing the discussion from [Email receive issue](https://meta.discourse.org/t/email-receive-issue/374615/25): I implemented valid\_recipients filtering via postfix/valid\_recipients and populated /etc/postfix/valid\_recipients. Since then, I’m seeing repeated warnings and inbound connection attempts every ~6 minutes. Here’s a sanitized segment of my log. warning Exact log output Jul 23 05:13:40 ubuntu-mail-receiver postfix/smtpd[2265]: warning: /etc/postfix/valid\_recipients, line 1: expected format: key whitespace value -- ignoring this line Jul 23 0…
> 
> is it correct that i did modify main.cf
> 
> **DiscourseHelper:**
> 
> > **Searching**
> >
> > Searching for: Is it necessary or recommended to manually modify postfix main.cf when implementing a valid\_recipients file for recipient restrictions in a Discourse mail-receiver container? Should main.cf be edited directly, or are all recommended changes handled by docker environment variables or launcher yml settings for Discourse mail-receiver setups?
> 
> > **Reading**
> >
> > Read: [📬 Repeated Postfix warnings and connections after valid\_recipients implementation](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427)
> 
> No, it is **not** necessary or recommended to manually modify `main.cf` in the mail-receiver container for valid recipient filtering when following Discourse’s standard setup.
> 
> **Correct Approach:**  
> Discourse’s official mail-receiver guide and container setup is designed so you do **not** edit `main.cf` by hand. Instead:
> 
> - You should use the `mail-receiver.yml`’s `env` section to set Postfix parameters—specifically, using an environment variable like:
> 
> - Docker/launcher correctly applies these settings on container startup, injecting them into Postfix without needing to directly edit files.
> 
> Editing `main.cf` directly can cause conflicts or be overwritten on container rebuilds. It’s also easy to break things (such as file format or recipient mapping) this way.
> 
> **About Your Error:**  
> The warnings you see:
> 
> ```plaintext
> warning: /etc/postfix/valid_recipients, line 1: expected format: key whitespace value -- ignoring this line
> 
> ```
> 
> are caused by a misformatted `valid_recipients` file—not by how the config is set (env vs `main.cf`). Make sure your entries are like:
> 
> ```plaintext
> alloweduser@yourdomain.com OK
> another@yourdomain.com OK
> default REJECT
> 
> ```
> 
> No colons, equals, or commas—just the address, whitespace, and `OK` (or `REJECT`).
> 
> * * *
> 
> **Do not edit** `main.cf` unless you have a highly advanced, fully custom configuration and understand exactly what you are doing.  
> All normal instructions (including valid recipient and sender filtering) are performed by setting environment variables in `mail-receiver.yml`.
> 
> * * *
> 
> **References:**
> 
> - [Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver](https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites-with-mail-receiver/49487)
> - [Customize direct-delivery Postfix configuration](https://meta.discourse.org/t/customise-direct-delivery-postfix-configuration/118759)
> - Your referenced topic: [Repeated Postfix warnings and connections after valid\_recipients implementation](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427)
> 
> **Summary:**  
> You should not need to touch `main.cf` for standard Discourse mail-receiver setups. Environment variables in the `yml` are the recommended, supported way. For recipient maps, always use proper hash/texthash formats and correct file syntax.

* * *

actually i’ve removed the custom configuration entirely, the configuration described [here](https://meta.discourse.org/t/email-receive-issue/374615/25), and my mail test worked fine.

```plaintext
x86_64 arch detected.
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 mail-receiver
mail-receiver
release: Pulling from discourse/mail-receiver
Digest: sha256:2a0d45bb92a783c846a821e635413764eeadb3441ef6190085545a4[9 digits redacted]
Status: Image is up to date for discourse/mail-receiver:release
docker.io/discourse/mail-receiver:release
ERROR: Can't find Ruby library file or shared library pups
cd /pups && /pups/bin/pups --stdin
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
sha256:[6 digits redacted]69734d779a95ec83c7103dc2fc04f1d690ebde62[18 digits redacted]
[64 character API Key? Redacted]
Removing old container
+ /usr/bin/docker rm mail-receiver
mail-receiver

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e MAIL_DOMAIN=discourse. MYDOMAINNAME.com -e DISCOURSE_BASE_URL=https:// MYDOMAINNAME.com -e DISCOURSE_API_KEY=[64 digit API key redacted] -e DISCOURSE_API_USERNAME=system -h ubuntu-mail-receiver -e DOCKER_HOST_IP=172.17.0.1 --name mail-receiver -t -p 25:25 -v /var/discourse/shared/mail-receiver/postfix-spool:/var/spool/postfix --mac-address [redacacted mac address] local_discourse/mail-receiver /sbin/boot
[64 digit API key? Redacted]
root@ubuntu:/var/discourse# ./launcher logs mail-receiver
x86_64 arch detected.
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Operating environment:
HOSTNAME=ubuntu-mail-receiver
LANGUAGE=en_US.UTF-8
MAIL_DOMAIN=discourse.MYDOMAINNAME.com
DOCKER_HOST_IP=172.17.0.1
PWD=/
DISCOURSE_BASE_URL=https:// MYDOMAINNAME.com
HOME=/root
LANG=en_US.UTF-8
TERM=xterm
SHLVL=1
DISCOURSE_API_USERNAME=system
LC_ALL=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INCLUDE_DMARC=true
DISCOURSE_API_KEY=[64 digit API key redacted]
_=/usr/bin/env
Delivering mail sent to discourse. MYDOMAINNAME.com to Discourse
Starting OpenDKIM...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Adding user `postfix' to group `opendkim' ...
<86>Jul 23 13:27:19 usermod[16]: add 'postfix' to group 'opendkim'<86>Jul 23 13:27:19 usermod[16]: add 'postfix' to shadow group 'opendkim'Done.
Starting OpenDMARC...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
<22>Jul 23 13:27:19 opendkim[24]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)Adding user `postfix' to group `opendmarc' ...
<86>Jul 23 13:27:19 usermod[31]: add 'postfix' to group 'opendmarc'<86>Jul 23 13:27:19 usermod[31]: add 'postfix' to shadow group 'opendmarc'Done.
<22>Jul 23 13:27:19 opendmarc[39]: OpenDMARC Filter v1.4.2 starting (args: -c /etc/opendmarc.conf)<22>Jul 23 13:27:19 opendmarc[39]: additional trusted authentication services: (none)postfix: Postfix is using backwards-compatible default settings
Jul 23 13:27:19 ubuntu-mail-receiver postfix[51]: Postfix is using backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jul 23 13:27:19 ubuntu-mail-receiver postfix[51]: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Jul 23 13:27:19 ubuntu-mail-receiver postfix[51]: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Starting Postfix
Jul 23 13:27:19 ubuntu-mail-receiver postfix/master[1]: daemon started -- version 3.7.11, configuration /etc/postfix
Jul 23 13:27:53 ubuntu-mail-receiver postfix/smtpd[122]: connect from mail-il1-f180.google.com[209.85.166.180]
<22>Jul 23 13:27:54 policyd-spf[129]: : prepend Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.180; helo=mail-il1-f180.google.com; envelope-from= person@gmail.com; receiver=discourse. MYDOMAINNAME.com Jul 23 13:27:54 ubuntu-mail-receiver postfix/smtpd[122]: BC6D71BF9C8: client=mail-il1-f180.google.com[209.85.166.180]
Jul 23 13:27:54 ubuntu-mail-receiver postfix/cleanup[130]: BC6D71BF9C8: message-id=<CWXP1[redacted 8 digits]81B627937FA7F4B2CE65A15FA@CWXP123MB2918.GBRP123.PROD.OUTLOOK.COM>
<22>Jul 23 13:27:55 opendkim[24]: BC6D71BF9C8: DKIM verification successful<22>Jul 23 13:27:55 opendkim[24]: BC6D71BF9C8: s=20230601 d=gmail.com a=rsa-sha256 SSL <22>Jul 23 13:27:55 opendmarc[39]: implicit authentication service: ubuntu-mail-receiver.localdomain<22>Jul 23 13:27:55 opendmarc[39]: BC6D71BF9C8: gmail.com passJul 23 13:27:55 ubuntu-mail-receiver postfix/qmgr[120]: BC6D71BF9C8: from=<person@gmail.com>, size=75533, nrcpt=1 (queue active)
Jul 23 13:27:55 ubuntu-mail-receiver postfix/smtpd[122]: disconnect from mail-il1-f180.google.com[209.85.166.180] ehlo=1 mail=1 rcpt=1 bdat=2 quit=1 commands=6
<23>Jul 23 13:27:55 receive-mail[133]: Recipient: person.REDACTED@discourse. MYDOMAINNAME.comJul 23 13:27:55 ubuntu-mail-receiver postfix/pipe[132]: BC6D71BF9C8: to=< person.REDACTED@discourse. MYDOMAINNAME.com>, relay=discourse, delay=1.8, delays=1.6/0.01/0/0.22, dsn=2.0.0, status=sent (delivered via discourse service)
Jul 23 13:27:55 ubuntu-mail-receiver postfix/qmgr[120]: BC6D71BF9C8: removed

```

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [July 23, 2025, 4:31pm UTC](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427/3 "2025-07-23T16:31:21Z")

</div>

reply by email now works on my forum, the legacy valid\_recipients thing would have blocked that

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 22, 2025, 4:32pm UTC](https://meta.discourse.org/t/repeated-postfix-warnings-and-connections-after-valid-recipients-implementation/375427/4 "2025-08-22T16:32:14Z")

</div>

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