That is correct, I'm using postmaster@mydomain.com for the Postfix relay, hosted on mx.mailserver.com (iRedMail).
It shows root@mydomain.com because I tried to send an test e-mail (from SSH) while being logged in as root on mydomain.com.
Here's another test I did while being logged in as user1@mydomain.com (SSH). It results in the same error as before.
/var/log/maillog (iredmail server)
Nov 19 15:46:02 mx postfix/smtpd[6761]: connect from mydomain.com[IP]
Nov 19 15:46:02 mx postfix/smtpd[6761]: NOQUEUE: reject: RCPT from mydomain.com[IP]: 550 5.1.0 <user1@mydomain.com>: Sender address rejected: User unknown in virtual mailbox table; from=<user1@mydomain.com> to=<webmaster@anotherdomain.com> proto=ESMTP helo=<mydomain.com>
Nov 19 15:46:02 mx postfix/smtpd[6761]: disconnect from mydomain.com[IP]
My conclusion is that iRedMail does still not accept postmaster@mydomain.com to send e-mail where the FROM recipient does not match a user that exist on mx.mailserver.com. To test this theory further, I've added a generic SMTP map for the relay at mydomain.com to force FROM: to be postmaster@mydomain.com.
What I did was the following:
/etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic
/etc/postfix/generic:
root@mydomain.com postmaster@mydomain.com
user1@mydomain.com postmaster@mydomain.com
sudo postmap /etc/postfix/generic
sudo /etc/init.d/postfix reload
When I now try to send an e-mail while logged in as root@mydomain.com (SSH) to webmaster@anotherdomain.com it is accepted on mx.mailserver.com (iRedMail).
/var/log/maillog (iRedMail)
Nov 19 16:03:03 mx postfix/postscreen[7099]: CONNECT from [IP]:45460 to [IP.100]:25
Nov 19 16:03:03 mx postfix/postscreen[7099]: PASS OLD [IP]:45460
Nov 19 16:03:03 mx postfix/smtpd[7100]: connect from mydomain.com[IP]
Nov 19 16:03:03 mx postfix/smtpd[7100]: 47HVwR6436z3wk3: client=mydomain.com[IP]
Nov 19 16:03:03 mx postfix/cleanup[7105]: 47HVwR6436z3wk3: message-id=<20191119160303.AF364221D2@mydomain.com>
Nov 19 16:03:03 mx postfix/qmgr[722]: 47HVwR6436z3wk3: from=<postmaster@mydomain.com>, size=613, nrcpt=1 (queue active)
Nov 19 16:03:03 mx postfix/smtpd[7100]: disconnect from mydomain.com[IP]
Nov 19 16:03:05 mx postfix/10025/smtpd[7111]: connect from localhost[127.0.0.1]
Nov 19 16:03:05 mx postfix/10025/smtpd[7111]: 47HVwT0WqJz3wkw: client=localhost[127.0.0.1]
Nov 19 16:03:05 mx postfix/cleanup[7105]: 47HVwT0WqJz3wkw: message-id=<20191119160303.AF364221D2@mydomain.com>
Nov 19 16:03:05 mx postfix/qmgr[722]: 47HVwT0WqJz3wkw: from=<postmaster@mydomain.com>, size=1063, nrcpt=1 (queue active)
Nov 19 16:03:05 mx amavis[27013]: (27013-02) Passed CLEAN {RelayedInbound}, [IP]:45460 [IP] <postmaster@mydomain.com> -> <webmaster@anotherdomain.com>, Queue-ID: 47HVwR6436z3wk3, Message-ID: <20191119160303.AF364221D2@mydomain.com>, mail_id: 1NhW9fbEmwef, Hits: 1.205, size: 613, queued_as: 47HVwT0WqJz3wkw, 1256 ms, Tests: [MISSING_HEADERS=1.207,SPF_HELO_PASS=-0.001,SPF_PASS=-0.001]
Nov 19 16:03:05 mx amavis[27013]: (27013-02) Passed CLEAN, <postmaster@mydomain.com> -> <webmaster@anotherdomain.com>, Hits: 1.205, tag=2, tag2=6.2, kill=6.9, queued_as: 47HVwT0WqJz3wkw, L/0/0/0
Nov 19 16:03:05 mx postfix/10025/smtpd[7111]: disconnect from localhost[127.0.0.1]
Nov 19 16:03:05 mx postfix/amavis/smtp[7108]: 47HVwR6436z3wk3: to=<webmaster@anotherdomain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.4, delays=0.1/0.01/0/1.3, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 47HVwT0WqJz3wkw)
Nov 19 16:03:05 mx postfix/qmgr[722]: 47HVwR6436z3wk3: removed
Nov 19 16:03:05 mx postfix/pipe[7112]: 47HVwT0WqJz3wkw: to=<webmaster@anotherdomain.com>, relay=dovecot, delay=0.13, delays=0.05/0.01/0/0.07, dsn=2.0.0, status=sent (delivered via dovecot service)
Nov 19 16:03:05 mx postfix/qmgr[722]: 47HVwT0WqJz3wkw: removed
Just to make sure everything is dandy in /opt/iredmail/settings.py, here is a copy of the config (I've taken out the LDAP-part in the end as it is irrelevant).
############################################################
# DO NOT MODIFY THIS LINE, IT'S USED TO IMPORT DEFAULT SETTINGS.
from libs.default_settings import *
############################################################
# Listen address and port.
listen_address = "127.0.0.1"
# Port for normal Postfix policy requests.
listen_port = "7777"
# Ports for SRS (Sender Rewriting Scheme).
# - `srs_forward_port` is used in Postfix parameter `sender_canonical_maps`.
# - `recipient_canonical_maps` is used in Postfix parameter `recipient_canonical_maps`.
srs_forward_port = "7778"
srs_reverse_port = "7779"
# Run as a low privileged user.
run_as_user = "iredapd"
# Path to pid file.
pid_file = '/var/run/iredapd.pid'
# Log level: info, debug.
log_level = "info"
# Backend: ldap, mysql, pgsql.
backend = "mysql"
# Enabled plugins.
plugins = ["reject_null_sender", "wblist_rdns", "reject_sender_login_mismatch", "greylisting", "throttle", "amavisd_wblist", "sql_alias_access_policy"]
# SRS (Sender Rewriting Scheme)
#
# The secret key(s) used to generate cryptographic hash.
# The first secret key is used for generating AND verifying hash in SRS
# address. If you have old keys, you can append them also for verification only.
srs_secrets = ["XXX"]
# Rewrite address will be 'xxx@<srs_domain>', so please make sure `srs_domain`
# is a resolvable mail domain name and pointed to your server.
srs_domain = "mx.mailserver.com"
# Allow certain users to send e-mail as non-existing user
ALLOWED_LOGIN_MISMATCH_SENDERS = ["postmaster@mydomain.com"]
# For LDAP backend.
EDITED.
I am none the wiser and even though I've managed to send e-mails successfully using generic mapping - it's not a optimal solution to the problem.