I installed Mailcow according to the documentation (https://mailcow.github.io/mailcow-dockerized-docs/i_u_m_install). I created a domain “domain.com” and a user “relay@domain.com”. I can log in with “relay@domain.com” at https://MAILSERVER/sogo and i can send and receive e-mails as expected.
On all servers I want to use Postfix as a null client and the mailcow server as a relay for messages from cronjobs, web forms etc. My Postfix configuration for e.g. s1.domain.com looks like this:
/etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP
alias_database =
alias_maps =
compatibility_level = 2
myhostname = s1.domain.com
mydestination =
local_recipient_maps =
local_transport = error:local mail delivery is disabled
inet_interfaces = loopback-only
virtual_alias_maps = hash:$config_directory/alias_maps
smtp_use_tls = yes
smtp_tls_security_level = may
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
relayhost = MAILSERVER:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:$config_directory/relay_password
smtp_sasl_security_options = noanonymous
disable_vrfy_command = yes
/etc/postfix/alias_maps:
@s1.domain.com hostmaster@domain.com
/etc/postfix/relay_password
MAILSERVER:587 relay@domain.com:PASSWORD
When I run for example echo $(uname -r) | mail -s 'Status' RECIPIENT@domain.com
as “root” on the command line, I get the following error:
/var/log/mail.log
...
May 12 14:16:52 s1 postfix/smtp[2842]: A83073E8CD: to=<RECIPIENT@domain.com>, relay=MAILSERVER[IPv6]:587, delay=1.6, delays=0.04/0.03/1.5/0.06, dsn=5.7.1, status=bounced (host MAILSERVER[IPv6] said: 553 5.7.1 <root@s1.domain.com>: Sender address rejected: not owned by user relay@domain.com (in reply to RCPT TO command))
...
When I try to send via a web contact form:
...
May 12 12:04:02 s1 postfix/pickup[712]: 040F43EACC: uid=33 from=<WEBFORMULAR@domain.com>
...
May 12 12:04:02 s1 postfix/qmgr[713]: 040F43EACC: from=<WEBFORMULAR@domain.com>, size=6120, nrcpt=1 (queue active)
...
May 12 12:04:02 s1 postfix/smtp[779]: 040F43EACC: to=<WEBFORMULAR@domain.com>, relay=MAILSERVER[IPv4]:587, delay=0.39, delays=0.05/0.03/0.26/0.06, dsn=5.7.1, status=bounced (host MAILSERVER[IPv4] said: 553 5.7.1 <WEBFORMULAR@domain.com>: Sender address rejected: not owned by user relay@domain.com (in reply to RCPT TO command))
...
Am I basically doing something wrong here? Is the main.cf (s1.domain.com) correct? Do I have to make additional entries on the mailcow server? Do I have to make additional entries in the main.cf on the client s1.domain.com? What do I generally have to do so that e-mails on s1.domain.com are relayed via the account relay@domain.com?
I would be very grateful for any advice.