Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver

How is this done to create a new container definition in that directory!?

By running the commands shown immediately following that text. Strictly speaking you aren’t creating the file in that directory but inside the containers subdirectory, same as app.yml.

2 Likes

Thanks, at first those didn’t seem to be working but now have gotten to the text editor with:

There seems to be a problem with this, when running

./launcher logs mail-receiver

reports discourse_base_url=https://discourse.example.com, instead of specified domain set in text editor.

Tried rebuilding/relaunching bootstrap of mail-receiver but hasn’t changed to correct domain.

1 Like

Cause of error
image

1 Like

I’m having a little trouble I could use some advice!

root@JEN /var/discourse # ./launcher start mail-receiver
x86_64 arch detected.

starting up existing container
+ /usr/bin/docker start mail-receiver
Error response from daemon: driver failed programming external connectivity on endpoint mail-receiver (721279d807e22a80580f2357fae40cc): Error starting userland proxy: listen tcp4 0.0.0.0:25: bind: address already in use
Error: failed to start containers: mail-receiver

then…

root@JEN /var/discourse # sudo lsof -i tcp:25
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
master  4400 root   13u  IPv4  24419      0t0  TCP *:smtp (LISTEN)
master  4400 root   14u  IPv6  24420      0t0  TCP *:smtp (LISTEN)

I also tried…

root@JEN /var/discourse # netstat -nlp | grep 25
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      4400/master
tcp6       0      0 :::25                   :::*                    LISTEN      4400/master

and…

root@JEN /var/discourse # ps j 4400
   PPID     PID    PGID     SID TTY        TPGID STAT   UID   TIME COMMAND
      1    4400    4400    4400 ?             -1 Ss       0   0:02 /usr/lib/postfix/sbin/master -w

I’m finding instructions online to stop the container and kill the process (process 4400?)

Is this safe, and will it correct the problem?

Do I need to (or should I, or should I not) change port 25 to a different port in the mail-receiver.yml file?

1 Like

Maybe you installed postfix and need to remove it?

You can’t change the port. You need to stop whatever is using it. Just killing it won’t work because when your reboot it’ll be a race to see which process starts first.

3 Likes

That’s what I was thinking too. I can’t imagine how it got on there, but I’ll try removing it. Otherwise I can just use gmail which seems to be working just fine.

2 Likes

I’ve just moved my forum to a new environment and as a result re-installed the mail-receiver. It looks like it’s a newer version than I previously had installed. The YML config has changed a little with DISCOURSE_BASE_URL replacing DISCOURSE_MAIL_ENDPOINT. The YML file contents reflect the change but the instructions at the top of this thread need updating.

Also when receiving an email that is bounced/rejected I’m getting the following errors…

Jun 08 11:50:42 mail-receiver postfix/smtp[117]: fatal: unknown service: smtp/tcp
Jun 08 11:50:42 mail-receiver postfix/smtp[118]: fatal: unknown service: smtp/tcp
Jun 08 11:50:43 mail-receiver postfix/qmgr[101]: warning: private/smtp socket: malformed response
Jun 08 11:50:43 mail-receiver postfix/qmgr[101]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Jun 08 11:50:43 mail-receiver postfix/master[1]: warning: process /usr/lib/postfix/sbin/smtp pid 117 exit status 1
Jun 08 11:50:43 mail-receiver postfix/master[1]: warning: /usr/lib/postfix/sbin/smtp: bad command startup -- throttling
Jun 08 11:50:43 mail-receiver postfix/qmgr[101]: warning: private/smtp socket: malformed response
Jun 08 11:50:43 mail-receiver postfix/master[1]: warning: process /usr/lib/postfix/sbin/smtp pid 118 exit status 1
Jun 08 11:50:43 mail-receiver postfix/qmgr[101]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description

Valid messages seem to be handled correctly. The previous version of mail-receiver didn’t give these errors as far as I could see from recent log files. I did a little research and came across - https://blog.badgerops.net/smtp-socket-malformed-response-on-a-fips140-2-sytstem/

Adding the following to the mail-receiver.yml file seems to fix the problem for me:

  ## Fix smtp errors
  POSTCONF_smtp_tls_fingerprint_digest: sha256
  POSTCONF_smtpd_tls_fingerprint_digest: sha256
4 Likes

Dropping a post here to note that we’ve added DMARC support to the mail-receiver via an image discourse/mail-receiver:with-dmarc. Please refer to Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver in the OP for more details.

2 Likes

2 posts were merged into an existing topic: Mail-receiver relay access denied