Hello,
I have managed to set up my web server on debian with various virtual servers in virtualmin, but I cannot get my mailserver to work. I am sending mail using mailgun and followed the tutorial at https://www.digitalocean.com/community/tutorials/how-to-set-up-a-mail-re... as well as the Mailgun-documentation at https://documentation.mailgun.com/user_manual.html#smtp-relay. I am using Lets Encrypt Certificates and want to setup the mailserver for various domains/virtual servers. Two domains (domain1.com, domain2.com) have already been transferred to the server, my main domain (domain3.com) that I use for all my email is already set up in Virtualmin but the DNS records currently still point to my old shared webhosting provider.
I have the following issues:
My main.cf file:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
#mailgun
mydomain = domain1.com
myorigin = $mydomain
mydestination = 868989.server.hoster.org, localhost.server.hoster.org, , localhost
relayhost = [smtp.mailgun.org]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
# TLS support
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
#security
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
#maps
smtp_generic_maps = hash:/etc/postfix/generic
virtual_alias_maps = hash:/etc/postfix/virtual
myhostname = 868989.server.hoster.org
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
smtpd_sasl_auth_enable = yes
Another strange thing I noticed: When I add my backup mx servers (mailgun) in my dns configuration with a lower priority (10 instead of 5), the mailgun MX-Server receives my mail. So my local server seems not to be running a mailserver?