Postfix mailserver trouble

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-relay-with-postfix-and-mailgun-on-ubuntu-16-04 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:

  • I cannot receive any mails sent from outside the server (e.g. gmail), they do not even appear in the mail.log
  • I can receive internal mails in ReadUserMail, but they do not appear in my Thunderbird Inbox or Roundcube Inbox
  • I can send mails from Roundcube and ReadUserMail, but I cannot connect Thunderbird to the SMTP-Server. Telnet-Result on all SMTP-Ports (25, 465, 587) is "telnet: Unable to connect to remote host: Connection refused", ufw status is currently set to disabled.
  • The emails sent from roundcube/ReadUserMail are always signed by domain1.com (the one I used as Lets encrypt certificate for Dovecot+Postfix), even if they are sent from user@domain2.com
  • From my normal email-adress (on my old webhosting @domain3.com) in Thunderbird I can send mails to user@domain1.com (no bounce, but they never arrive on my mail server), but when trying to send mails to domain2.com, I get the error "User unknown in virtual alias table". Domain 2 contains special characters.

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?