I've been trying to set up a mail server, with dovecot, postfix, opendkim, and spamassassin. After some hassle I managed to get incoming mail working (I signed up for this account with the email!). However, outgoing mail just doesn't work--I tested this by sending from this new email to my old Protonmail account and got an error. Again, it works with incoming mail--sending from that old email to my new one. Sending was tested with Neomutt using msmtp as its mail sending command.

I've got a relayhost that goes to port 587 of my domain. This is because my ISP is fat and blocks port 25 for some reason. Anyways, here's the log messages I get when sending an email:

postfix/submission/smtpd[57255]: NOQUEUE: reject: RCPT from unknown[]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail.doma.in>
postfix/smtp[57263]: E45589003B2: to=<[email protected]>, relay=MY.IP[MY.IP]:587, delay=0.2, delays=0.14/0.02/0.02/0.02, dsn=4.7.1, status=deferred (host MY.IP[MY.IP] said: 454 4.7.1 <[email protected]>: Relay access denied (in reply to RCPT TO command))
postfix/submission/smtpd[57255]: disconnect from unknown[] ehlo=2 starttls=1 mail=1 rcpt=0/1 data=0/1 rset=1 quit=1 commands=6/8

postconf -n:

alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/bin
compatibility_level = 3.6
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Mail/Inbox/
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mailbox_command = /usr/lib/dovecot/deliver
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
milter_default_action = accept
milter_protocol = 6
mydestination = $myhostname, $mydomain, localhost, localhost.localdomain,, MY.IP
mydomain = doma.in
myhostname = mail.doma.in
mynetworks = , [::1]/128 MY.IP/32 MY.PRIVATE.IP MY.IP
newaliases_path = /usr/bin/newaliases
non_smtpd_milters = inet:
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
relay_domains = $mydestination
relayhost = [MY.IP]:587
sample_directory = /etc/postfix
sendmail_path = /usr/bin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
smtp_tls_CAfile = /etc/letsencrypt/live/doma.in/cert.pem
smtp_tls_loglevel = 3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_security_level = may
smtpd_milters = inet:
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options =
smtpd_sasl_tls_security_options =
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/doma.in/fullchain.pem
smtpd_tls_exclude_ciphers = aNULL, LOW, EXP, MEDIUM, ADH, AECDH, MD5, DSS, ECDSA, CAMELLIA128, 3DES, CAMELLIA256, RSA+AES, eNULL
smtpd_tls_key_file = /etc/letsencrypt/live/doma.in/privkey.pem
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_security_level = may
tls_preempt_cipherlist = yes
unknown_local_recipient_reject_code = 550

it's listening on port 587:

# lsof -i -P -n|grep 587
master    57239      root   94u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57364   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57367   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57371   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57374   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)

why am I getting this error? I've gone through several other questions where this was asked, notably:

None of those helped, though

  • It's a bit unclear what you're doing here. You have created a new domain, and are trying to send mails from that through a mailserver that has a different domain?
    – Panki
    Commented Jul 10, 2021 at 9:28
  • Yes, I created a domain, set up all the records and stuff, and then set up the mailserver. I'm trying to send mail through Neomutt to my old email (a Protonmail account), and I get this. Works fine when sending from old -> new.
    – swurl
    Commented Jul 10, 2021 at 19:53

1 Answer 1


I finally fixed this by adding to mynetworks. I've got another problem but I'll open up a new question for that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .