When you say “it doesn’t work”, what do you mean? Are there errors / does the message get marked as spam?
I receive no error message. below is what is shown from the mail.log file on my webserver after sending a test message
which never arrives in my mailbox.
Oct 4 19:09:53 serv1 postfix/pickup[72931]: B7BECFE03E6: uid=0 from=<root>
Oct 4 19:09:53 serv1 postfix/cleanup[76050]: B7BECFE03E6: message-id=20221004230953.B7BECFE03E6@mydomain.com
Oct 4 19:09:53 serv1 postfix/qmgr[72932]: B7BECFE03E6: from=root@mydomain.com, size=429, nrcpt=1 (queue active)
Oct 4 19:09:53 serv1 postfix/local[76052]: B7BECFE03E6: to=karl@mydomain.com, relay=local, delay=0.13, delays=0.09/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 4 19:09:53 serv1 postfix/qmgr[72932]: B7BECFE03E6: removed
trusted network configuration
myhostname = mail.mydomain.com
mynetworks = 127.0.0.0/8 172.22.1.0/24 172.16.0.0/24 192.168.10.0/24 10.10.0.0/24
postfix logs from mailcow.
10/04/2022, 07:08:30 PM info disconnect from unknown[172.16.0.11] helo=1 mail=1 rcpt=1 data=1 commands=4
10/04/2022, 07:08:30 PM info timeout after END-OF-MESSAGE from unknown[172.16.0.11]
I’m able to send and receive a test email using telnet on port 25 from web server to mailcow server.
both my webserver and mailcow server are on the same trusted network 172.16.0.0/24
ufw is not enabled on mailcow server.
ufw is enabled on webserver with port 25 and 587 open
Postfix main.cf file on webserver
myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, mydomain.com, serv1, localhost.localdomain, localhost
relayhost = [mail.mydomain.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
[mail.mydomain.com]:587 karl@mydomain.com:mypassword