Skip to content

Debugging postfix and set relay host variables the right way #133

@codiflow

Description

@codiflow

Thanks for this interesting project – turns out that its "just" postfix with some nice automation around it. Like it!

Unfortunately the postfix log output is not pushed to stdout so docker compose logs -t -f does not tell you what goes wrong (if something does).

You can still get the postfix log file with the following command (maybe you have to change the container name accordingly):
docker exec -it simple-mail-forwarder-smf-1 tail /var/log/postfix/postfix.log

And if you are using the SMF_RELAYHOST variable DON'T USE QUOTATION MARKS (as listed in the documentation) as they will break your postfix configuration resulting in errors and no mail redirection.

You will get errors like this if SMF_RELAYAUTH uses quotation marks:

May 07 18:41:19 mailrelay postfix/smtpd[1014]: connect from unknown[192.168.2.5]
May 07 18:41:19 mailrelay postfix/smtpd[1014]: lost connection after UNKNOWN from unknown[192.168.2.5]
May 07 18:41:19 mailrelay postfix/smtpd[1014]: disconnect from unknown[192.168.2.5] unknown=0/2 commands=0/2
... => no more output here

And those if you use SMF_RELAYHOST with quotation marks:

May 07 18:27:27 mailrelay postfix/smtpd[1026]: disconnect from unknown[192.168.2.5] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
May 07 18:27:27 mailrelay postfix/smtpd[1014]: lost connection after HELO from unknown[192.168.2.5]
May 07 18:27:27 mailrelay postfix/smtpd[1014]: disconnect from unknown[192.168.2.5] helo=1 commands=1
May 07 18:27:27 mailrelay postfix/smtp[1046]: fatal: valid hostname or network address required in server description: "[YourExternalRelayHost.de]:587"
May 07 18:27:28 mailrelay postfix/qmgr[1006]: warning: private/smtp socket: malformed response
May 07 18:27:28 mailrelay postfix/qmgr[1006]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
May 07 18:27:28 mailrelay postfix/master[1004]: warning: process /usr/libexec/postfix/smtp pid 1046 exit status 1
May 07 18:27:28 mailrelay postfix/master[1004]: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling
May 07 18:27:28 mailrelay postfix/error[1047]: 16501621231: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=1, delays=0.02/1/0/0.01, dsn=4.3.0, status=deferred (unknown mail transport error)

Just enter the value behind the = and if you need to specify the port use square brackets around it like in the following example.

Example docker-compose.yml which works (after entering your details into it):

ervices:
    smf:
        image: zixia/simple-mail-forwarder
        ports:
            - 25:25
        environment:
            - [email protected]:[email protected]:OptionalPasswordForMailaddressAtYourInternalDomain
            # DON'T USE QUOTATION MARKS HERE
            - SMF_RELAYHOST=[YourExternalRelayHost.de]:587
            # DON'T USE QUOTATION MARKS HERE
            - SMF_RELAYAUTH=UsernameForExternalRelayHost:PasswordForExternalRelayHost
            - SMF_SENDERPRIVACY=true

Hope this helps people setting this up quick and easy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions