0

I have a Linux server set up with Postfix and Dovecot. I have an address I am using to test the mail sending, user@anotherdomain.com. I can send out mail fine. However, when an email is sent to the email address, Postfix rewrites the recipient from user@anotherdomain.com to user@mail.firstdomain.com. mail.firstdomain.com is the domain I am using as the server hostname. I can't figure out why its doing this, here's my Postfix main.cf:

compatibility_level = 3.6
mail_owner = postfix
myhostname = mail.firstdomain.com
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain,
ftp.$mydomain                             <---- adding anotherdomain.com here doesn't solve the issue
mailbox_transport = lmtp:unix:private/dovecot-lmtp
mua_client_restrictions = permit_sasl_authenticated, reject
mua_sender_restrictions = permit_sasl_authenticated, reject
mua_helo_restrictions = permit_mynetworks, reject_non_fqdn_hostname, reject_invalid_hostname, permit
unknown_local_recipient_reject_code = 550
alias_database = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
home_mailbox = /home/anotherdomain/Maildir
append_dot_mydomain = no
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
check_policy_service unix:private/policyd-spf
milter_default_action = accept
milter_protocol = 6
smtpd_milters = local:/var/spool/postfix/var/run/opendkim/opendkim.sock
non_smtpd_milters = $smtpd_milters
sendmail_path = /usr/bin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop

Here's my /etc/postfix/virtual:

root@mail.firstdomain.com user
webmaster@mail.firstdomain.com user
user@anotherdomain.com user       <---- removing this doesn't solve the issue

Here's the Postfix log when I try to send an email to user@anotherdomain.com:

Jan 12 07:16:43 mail.firstdomain.com postfix/smtpd[48716]: connect from unknown[IP ADDRESS]
Jan 12 07:16:46 mail.firstdomain.com postfix/smtpd[48716]: 07253202AC3: client=unknown[IP ADDRESS], sasl_method=PLAIN, sasl_username=user@anotherdomain.com
Jan 12 07:16:46 mail.firstdomain.com postfix/cleanup[48726]: 07253202AC3: message-id=<880f7619a1d8d.7c1e420159d1e@anotherdomain.com>
Jan 12 07:16:46 mail.firstdomain.com postfix/qmgr[48657]: 07253202AC3: from=<user@anotherdomain.com>, size=1439, nrcpt=1 (queue active)
Jan 12 07:16:46 mail.firstdomain.com postfix/local[48730]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Jan 12 07:16:46 mail.firstdomain.com postfix/local[48730]: 07253202AC3: passing <user@mail.firstdomain.com> to transport=lmtp
Jan 12 07:16:46 mail.firstdomain.com postfix/lmtp[48731]: 07253202AC3: to=<user@mail.firstdomain.com>, orig_to=<user@anotherdomain.com>, relay=mail.firstdomain.com[private/dovecot-lmtp], delay=0.83, delays=0.81/0.01/0.01/0.01>
Jan 12 07:16:46 mail.firstdomain.com postfix/cleanup[48726]: 92200202AC4: message-id=<20230112071646.92200202AC4@mail.firstdomain.com>
Jan 12 07:16:46 mail.firstdomain.com postfix/qmgr[48657]: 92200202AC4: from=<>, size=4193, nrcpt=1 (queue active)
Jan 12 07:16:46 mail.firstdomain.com postfix/local[48730]: 92200202AC4: passing <user@mail.firstdomain.com> to transport=lmtp
Jan 12 07:16:46 mail.firstdomain.com postfix/bounce[48733]: 07253202AC3: sender non-delivery notification: 92200202AC4
Jan 12 07:16:46 mail.firstdomain.com postfix/qmgr[48657]: 07253202AC3: removed
Jan 12 07:16:46 mail.firstdomain.com postfix/lmtp[48731]: 92200202AC4: to=<user@mail.firstdomain.com>, orig_to=<user@anotherdomain.com>, relay=mail.firstdomain.com[private/dovecot-lmtp], delay=0, delays=0/0/0/0, dsn=5.1.1, st>
Jan 12 07:16:46 mail.firstdomain.com postfix/qmgr[48657]: 92200202AC4: removed
Jan 12 07:16:46 mail.firstdomain.com postfix/smtpd[48716]: disconnect from unknown[IP ADDRESS] ehlo=2 starttls=1 auth=1 mail=1 rcpt=1 data=1 commands=7

It seems that Postfix is simply replacing the domain with the Email hostname. Why is this?

UltraCode
  • 1
  • 2

0 Answers0