i am new to mailservers and i think i totaly destroyed the config and i have no clue how to fix this mess.
For my understanding things are "OK" but i think i'm missing something important.
I replaced IPs with SERVER1 and SERVER2 and the domain with MYDOMAIN.
Setup:
2 Hetzner Server: One for Website (SERVER1 – VPS), another one for mails and other stuff (SERVER2 – Webhosting)
The website needs to send smtp mails with PHP and this part is working. But if the user mail is user@MYDOMAIN.com, it wont be delivered and i get the errors:
status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550 Sender verify failed (in reply to MAIL FROM command))
status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550 Unroutable address (in reply to RCPT TO command))
I tried so many different things and configurations but neither of them works.
Here is where it is at right now.
DNS:
$TTL 7200
@ IN SOA ns1.your-server.de. postmaster.your-server.de. (
2018033101 ; serial
86400 ; refresh
10800 ; retry
3600000 ; expire
86400 ) ; minimum
@ IN NS ns3.second-ns.de.
@ IN NS ns.second-ns.com.
@ IN NS ns1.your-server.de.
@ IN A SERVER1
entwickler IN A SERVER2
mail IN A SERVER2
www IN A SERVER1
autoconfig IN CNAME mail.your-server.de.
ftp IN CNAME www
imap IN CNAME mail
pop IN CNAME mail
relay IN CNAME mail
smtp IN CNAME mail
@ IN MX 10 mail
_autodiscover._tcp IN SRV 0 100 443 mail.your-server.de.
@ IN TXT "v=spf1 +a +mx ?all"
Hostname SERVER1:
hostname -> mail
hostname -f -> mail.MYDOMAIN.com
Postfix config:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.MYDOMAIN.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = MYDOMAIN.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
I am very thankful for any kind of advice and help you guys can give me.
I'm trying to learn but mailservers are a real diva…
Let me know if you need some more informations.
UPDATE:
After I changed the origin and destination the error changed to something i already had before:
status=bounced (unknown user: "USER")
Here is the full log:
Apr 5 09:09:19 mail postfix/pickup[29043]: B30A82645F9: uid=33 from=<www-data>
Apr 5 09:09:19 mail postfix/cleanup[29052]: B30A82645F9: message-id=<20180405070919.B30A82645F9@mail.MYDOMAIN.com>
Apr 5 09:09:19 mail postfix/qmgr[29044]: B30A82645F9: from=<www-data@MYDOMAIN.com>, size=426, nrcpt=1 (queue active)
Apr 5 09:09:19 mail postfix/local[29054]: B30A82645F9: to=<USER@MYDOMAIN.com>, relay=local, delay=0.04, delays=0.02/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "USER")
Apr 5 09:09:19 mail postfix/cleanup[29052]: BAA252645FC: message-id=<20180405070919.BAA252645FC@mail.MYDOMAIN.com>
Apr 5 09:09:19 mail postfix/bounce[29055]: B30A82645F9: sender non-delivery notification: BAA252645FC
Apr 5 09:09:19 mail postfix/qmgr[29044]: BAA252645FC: from=<>, size=2296, nrcpt=1 (queue active)
Apr 5 09:09:19 mail postfix/qmgr[29044]: B30A82645F9: removed
Apr 5 09:09:19 mail postfix/local[29054]: BAA252645FC: to=<www-data@MYDOMAIN.com>, relay=local, delay=0.02, delays=0.01/0/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 5 09:09:19 mail postfix/qmgr[29044]: BAA252645FC: removed
Mails to gmail and so on are still working without errors.
I guess he's still trying to attach the mail to the localhost instead passing it over to the mail server?
UPDATE 2:
I now changed mydestination to localhost since this seems to be right?
Now the relay is the mailserver but 2 new errors show up:
Apr 5 10:18:45 mail postfix/pickup[29400]: 4BB7F264615: uid=33 from=<www-data>
Apr 5 10:18:45 mail postfix/cleanup[29425]: 4BB7F264615: message-id=<20180405081845.4BB7F264615@mail.MYDOMAIN.com>
Apr 5 10:18:45 mail postfix/qmgr[29401]: 4BB7F264615: from=<www-data@MYDOMAIN.com>, size=426, nrcpt=1 (queue active)
Apr 5 10:18:48 mail postfix/smtp[29426]: 4BB7F264615: to=<USER@MYDOMAIN.com>, relay=mail.MYDOMAIN.com[SERVER2]:25, delay=3.1, delays=0.02/0/3.1/0, dsn=5.0.0, status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550-Verification failed for <www-data@MYDOMAIN.com> 550-Unrouteable address 550 Sender verify failed (in reply to MAIL FROM command))
Apr 5 10:18:48 mail postfix/cleanup[29425]: 73183264624: message-id=<20180405081848.73183264624@mail.MYDOMAIN.com>
Apr 5 10:18:48 mail postfix/bounce[29438]: 4BB7F264615: sender non-delivery notification: 73183264624
Apr 5 10:18:48 mail postfix/qmgr[29401]: 73183264624: from=<>, size=2611, nrcpt=1 (queue active)
Apr 5 10:18:48 mail postfix/qmgr[29401]: 4BB7F264615: removed
Apr 5 10:18:51 mail postfix/smtp[29426]: 73183264624: to=<www-data@MYDOMAIN.com>, relay=mail.MYDOMAIN.com[SERVER2]:25, delay=3, delays=0.01/0/3/0.02, dsn=5.0.0, status=bounced (host mail.MYDOMAIN.com[SERVER2] said: 550 Unroutable address (in reply to RCPT TO command))
Apr 5 10:18:51 mail postfix/qmgr[29401]: 73183264624: removed
Best Answer
It appears that you may be missing some settings and may have some incorrect. You might try these settings
you have
mynetworks
set for localhost and are allowing that insmtpd_relay_restrictions
. Is SASL set up properly and working?