Score:0

POSTFIX - sending mails. My mails sent outside bounce back

fr flag

main.cf

compatibility_level = 2
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = mail.aufy.pl
mydomain = aufy.pl
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
mynetworks = 127.0.0.0/8, 192.168.1.100
relayhost = [mail.aufy.pl]:587
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
inet_protocols = ipv4
message_size_limit = 52428800
mailbox_size_limit = 1073741824
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
smtpd_use_tls = yes
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_cert_file = /etc/letsencrypt/live/aufy.pl/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/aufy.pl/privkey.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_loglevel =  3
smtpd_tls_received_header = yes
milter_protocol = 6
milter_default_action = accept
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

master.cf

smtp      inet  n       -       y       -       -       smtpd
submission inet n       -       y       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_tls_auth_only=yes
smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
        -o syslog_name=postfix/$service_name
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
postlog   unix-dgram n  -       n       -       1       postlogd
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

logs

Jun 24 16:04:11 mail postfix/submission/smtpd[526358]: 4C11B4E004D: client=mail.aufy.pl[192.168.1.100]
Jun 24 16:04:11 mail postfix/cleanup[526360]: 4C11B4E004D: message-id=<[email protected]>
Jun 24 16:04:11 mail opendkim[897]: 4C11B4E004D: external host mail.aufy.pl attempted to send as aufy.pl
Jun 24 16:04:11 mail postfix/smtp[526362]: 3A83B4E005D: to=<[email protected]>, relay=mail.aufy.pl[192.168.1.100]:587, conn_use=47, delay=0.13, delays=0.07/0.01/0/0.06, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 4C11B4E004D)
Jun 24 16:04:11 mail postfix/qmgr[526209]: 4C11B4E004D: from=<[email protected]>, size=9517, nrcpt=1 (queue active)
Jun 24 16:04:11 mail postfix/qmgr[526209]: 3A83B4E005D: removed
Jun 24 16:04:11 mail postfix/submission/smtpd[526358]: 5C8E14E005D: client=mail.aufy.pl[192.168.1.100]
Jun 24 16:04:11 mail postfix/cleanup[526360]: warning: 5C8E14E005D: message rejected: hopcount exceeded
Jun 24 16:04:11 mail postfix/smtp[526362]: 4C11B4E004D: to=<[email protected]>, relay=mail.aufy.pl[192.168.1.100]:587, conn_use=48, delay=0.09, delays=0.06/0/0/0.02, dsn=5.4.0, status=bounced (host mail.aufy.pl[192.168.1.100] said: 554 5.4.0 Error: too many hops (in reply to end of DATA command))

I am little newbie but I configured my mail server to receive emails well but I have problem that my server cannot send mails outside. It always loops back. I have TLS connection and using Roundcube. I would like someone experienced to check if my postfix config is ok. Can you help me?

Score:1
ne flag

Why do you have

 relayhost = [mail.aufy.pl]:587  

This is telling the server to relay mail to itself and is very likely where your problem is. If this server is meant to relay all mail to an upstream provider change the relay host, otherwise comment out this line and reload postfix. (If you are relaying emails through another provider you will likely need to do additional configuration)

aufy avatar
fr flag
Thank you. That fixed problem :)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.