0

My postfix/dovecot configuration, running on Ubuntu 18.04, works perfectly locally. Also, my dovecot can receive mails from outside mails (For example, gauthier@mydomain.com can receive a mail from a gmail address).

But when I try to send a mail outside (here to ausername@gmail.com), I have this error:

May 17 11:53:42 vpsgauthier dovecot: auth-worker(4395): Debug: sql(ausername@gmail.com): query: SELECT email as user, password FROM virtual_users WHERE email='ausername@gmail.com'
May 17 11:53:42 vpsgauthier dovecot: auth-worker(4395): sql(ausername): unknown user
May 17 11:53:42 vpsgauthier dovecot: auth: Debug: userdb out: NOTFOUND#0111
May 17 11:53:42 vpsgauthier postfix/pipe[4405]: 3390F12D3: to=<ausername@gmail.com>, relay=dovecot, delay=0.16, delays=0.06/0.04/0/0.05, dsn=5.1.1, status=bounced (user unknown)

It seems that Postfix transmits mail to Dovecot, and that Dovecot is searching inside virtual users the user "ausername@gmail.com", instead of sending the request to google's MX.

But, how can I change this please?

Here is my /etc/postfix/main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345

#https://blog.tjitjing.com/index.php/2012/03/guide-to-install-opendkim-for-multiple-domains-with-postfix-and-debian.html

# 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

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# 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=no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
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
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Can you help me please?

  • What is the sending IP address ? If it is in the "mynetworks" it should works as it is before the permit_sasl_authenticated. – Dom May 17 '21 at 11:23
  • You mean I should add the sending server domain to "mynetworks"? – LightGolgot May 17 '21 at 11:47
  • The sending server IP, yes. If it is not, you request to authenticate by SASL. http://www.postfix.org/postconf.5.html#smtpd_relay_restrictions, with all the available commands in http://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions – Dom May 17 '21 at 15:09

0 Answers0