I've try to set up my E-Mail server 📬. Dovecot + Postfix. I can sends, but I can't receives.
from xolatgames@programming.dev to selfhosted@lemmy.world on 31 Jul 15:48
https://programming.dev/post/54371648

Hello everyone! 👋✌️

I’ve try to use Dovecot + Postfix for setting up my own E-Mail server 📬

But I have some troubles here 😅. I can sends messages through my E-Mail address 🙂📨, but I can’t receives messages those was be sent from different address 📩❌😅

Please, help me to fix this issue who ones who can help me 🔧😁

The logs from journalctl -xeu postfix

Jul 31 14:02:56 mail.xolat.games postfix/qmgr[1163]: CC268296: from=<>, size=2889, nrcpt=1 (queue active)
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Warning: Failed to parse address from `From_'-line: Missing domain
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: mkdir(/home/root/Maildir) failed: Permission denied (euid=8(mail) egid=8(mail) missing +w perm: /home, dir owned by 0:0 mode=0755)
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: mkdir(/home/root/Maildir) failed: Permission denied (euid=8(mail) egid=8(mail) missing +w perm: /home, dir owned by 0:0 mode=0755)
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: Mailbox INBOX: Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. [2026-07-31 14:02:56]
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: sieve: msgid=<20260727174421.CC268296@mail.xolat.games>: failed to store into mailbox 'INBOX': Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. [2026-07-31 14:02:56]
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: sieve: failed to open logfile (LOGGING TO STDERR): open(/var/lib/dovecot/sieve/default.sieve.log) failed: Permission denied (euid=8(mail) egid=8(mail) missing +w perm: /var/lib/dovecot/sieve, we're not in group 1004(vmail), dir owned by 1004:1004 mode=0775)
Jul 31 14:02:56 mail.xolat.games dovecot[22176]: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: sieve: Execution of script 'default/default' was aborted due to temporary failure (user logfile /var/lib/dovecot/sieve/default.sieve.log may reveal additional details)
Jul 31 14:02:56 mail.xolat.games postfix/local[22175]: CC268296: to=<root@xolat.games>, orig_to=<postmaster@xolat.games>, relay=local, delay=332315, delays=332315/0.02/0/0.06, dsn=4.3.0, status=deferred (temporary failure. Command output: sieve: info: started log at 2026-07-31 14:02:56 +0000. error: msgid=<20260727174421.CC268296@mail.xolat.games>: failed to store into mailbox 'INBOX': Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. [2026-07-31 14:02:56]. )

The logs from cat /var/log/mail.log

2026-07-31T14:02:56.763692+00:00 mail postfix/qmgr[1163]: CC268296: from=<>, size=2889, nrcpt=1 (queue active)
2026-07-31T14:02:56.828022+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Warning: Failed to parse address from `From_'-line: Missing domain
2026-07-31T14:02:56.830219+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: mkdir(/home/root/Maildir) failed: Permission denied (euid=8(mail) egid=8(mail) missing +w perm: /home, dir owned by 0:0 mode=0755)
2026-07-31T14:02:56.830528+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: mkdir(/home/root/Maildir) failed: Permission denied (euid=8(mail) egid=8(mail) missing +w perm: /home, dir owned by 0:0 mode=0755)
2026-07-31T14:02:56.830731+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: Mailbox INBOX: Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. [2026-07-31 14:02:56]
2026-07-31T14:02:56.832453+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: sieve: msgid=<20260727174421.CC268296@mail.xolat.games>: failed to store into mailbox 'INBOX': Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. [2026-07-31 14:02:56]
2026-07-31T14:02:56.832584+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: sieve: failed to open logfile (LOGGING TO STDERR): open(/var/lib/dovecot/sieve/default.sieve.log) failed: Permission denied (euid=8(mail) egid=8(mail) missing +w perm: /var/lib/dovecot/sieve, we're not in group 1004(vmail), dir owned by 1004:1004 mode=0775)
2026-07-31T14:02:56.832661+00:00 mail dovecot: lda(root)<22176><5eFAMRCrbGqgVgAAuoFhiA>: Error: sieve: Execution of script 'default/default' was aborted due to temporary failure (user logfile /var/lib/dovecot/sieve/default.sieve.log may reveal additional details)
2026-07-31T14:02:56.843566+00:00 mail postfix/local[22175]: CC268296: to=<root@xolat.games>, orig_to=<postmaster@xolat.games>, relay=local, delay=332315, delays=332315/0.02/0/0.06, dsn=4.3.0, status=deferred (temporary failure. Command output: sieve: info: started log at 2026-07-31 14:02:56 +0000. error: msgid=<20260727174421.CC268296@mail.xolat.games>: failed to store into mailbox 'INBOX': Failed to autocreate mailbox: Internal error occurred. Refer to server log for more information. [2026-07-31 14:02:56]. )
2026-07-31T14:04:25.897233+00:00 mail postfix/submission/smtpd[22193]: connect from unknown[46.101.119.210]
2026-07-31T14:04:32.882147+00:00 mail postfix/submission/smtpd[22193]: SSL_accept error from unknown[46.101.119.210]: lost connection
2026-07-31T14:04:32.888445+00:00 mail postfix/submission/smtpd[22193]: NOQUEUE: lost connection after CONNECT from unknown[46.101.119.210]
2026-07-31T14:04:32.888622+00:00 mail postfix/submission/smtpd[22193]: disconnect from unknown[46.101.119.210] commands=0/0
2026-07-31T14:32:00.045293+00:00 mail dovecot: imap-login: Logged in: user=<hello>, method=PLAIN, rip=95.25.67.217, lip=5.35.81.149, mpid=22438, TLS, session=<uFZlDOlXSPRfGUPZ>
2026-07-31T14:32:01.145793+00:00 mail dovecot: imap-login: Logged in: user=<hello>, method=PLAIN, rip=95.25.67.217, lip=5.35.81.149, mpid=22443, TLS, session=<MuI0DelX4vdfGUPZ>

Postfix config at cat /etc/postfix/main.cf

# Which domain that locally-originated mail appears to come from.
# Debian policy suggests to read this value from /etc/mailname.
#XX needs a review in postinst&config
#myorigin = /etc/mailname
#myorigin = $mydomain
mydomain = xolat.games
myorigin = $mydomain
mail_name = $mydomain

# Text that follows the 220 code in the SMTP server's greeting banner.
# You MUST specify $myhostname at the start due to an RFC requirement.
smtpd_banner = $myhostname ESMTP $mail_name (Debian)

# IP protocols to use: ipv4, ipv6, or all
# (set this explicitly so `post-install upgrade-configuration' wont complain)
inet_protocols = ipv4

# List of "trusted" SMTP clients (maptype:mapname allowed) that have more
# privileges than "strangers".  If mynetworks is not specified (the default),
# mynetworks_style is used to compute its value.
#mynetworks_style = class
#mynetworks_style = subnet
mynetworks_style = host
#
mynetworks = 127.0.0.0/12 [::ffff:127.0.0.0]/104 [::1]/128

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

# List of domains (maptype:mapname allowed) that this machine considers
# itself the final destination for.
mydestination = $myhostname, xolat.games, mail.xolat.games, localhost.xolat.games, localhost

# Maximum size of a user mailbox
mailbox_size_limit = 0

# Optional external command to use instead of mailbox delivery.  If set,
# you must set up an alias to forward root mail to a real user.
#mailbox_command = /usr/bin/procmail
#mailbox_command = /usr/bin/procmail -a "$EXTENSION"
#mailbox_command = 

# List of alias maps to use to lookup local addresses.
# Per Debian Policy it should be /etc/aliases.
alias_maps = hash:/etc/aliases

# List of alias maps to make indexes on, when running newaliases.
alias_database = hash:/etc/aliases

# Notify (or not) local biff service when new mail arrives.
# Rarely used these days.
biff = no

# Separator between user name and address extension (user+foo@domain)
#recipient_delimiter = +
recipient_delimiter = +

# A host to send "other" mail to
#relayhost = $mydomain
#relayhost = [gateway.example.com]
#relayhost = [ip.add.re.ss]:port
#relayhost = uucphost
relayhost = 

# Where to look for Cyrus SASL configuration files.  Upstream default is unset
# (use compiled-in SASL library default), Debian Policy says it should be
# /etc/postfix/sasl.
cyrus_sasl_config_path = /etc/postfix/sasl

# SMTP server RSA key and certificate in PEM format
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.xolat.games/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.xolat.games/privkey.pem
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_auth_only = yes
smtpd_tls_loglevel = 1
# SMTP Server security level: none|may|encrypt
smtpd_tls_security_level = may

smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:8991
non_smtpd_milters = inet:localhost:8991
mailbox_command = /usr/lib/dovecot/deliver

smtpd_forbid_bare_newline = normalize
smtpd_forbid_bare_newline_exclusions = $mynetworks

smtpd_sender_login_maps = pcre:/etc/postfix/login_maps.pcre
smtpd_sender_restrictions = reject_sender_login_mismatch, permit_sasl_authenticated, permit_mynetworks, reject_unknown_reverse_client_hostname, reject_unknown_sender_domain
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_unknown_recipient_domain
smtpd_relay_restrictions = permit_sasl_authenticated, reject_unauth_destination
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname

home_mailbox = Maildir/INBOX

default_privs = mail

header_checks = regexp:/etc/postfix/header_checks

# List of CAs for SMTP Client to trust
# Prefer this over _CApath when smtp is running chrooted
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_loglevel = 1
# SMTP Client TLS security level: none|may|encrypt|...
smtp_tls_security_level = may

smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1

# SMTP Client TLS session cache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
#smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.xolat.games
inet_interfaces = all

Postfix config at cat /etc/postfix/master.cf

# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: https://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (no)    (never) (100)
# ==========================================================================
#smtp	unix	-	-	n	-	-	smtp
smtp      inet  n       -       y       -       -       smtpd
#smtp      inet  n       -       y       -       1       postscreen
#smtpd     pass  -       -       y       -       -       smtpd
#dnsblog   unix  -       -       y       -       0       dnsblog
#tlsproxy  unix  -       -       y       -       0       tlsproxy
# Choose one: enable submission for loopback clients only, or for any client.
#127.0.0.1:submission inet n -   y       -       -       smtpd
   -o content_filter=spamassasin
submission inet n       -       y       -       -       smtpd
   -o syslog_name=postfix/submission
#  -o smtpd_forbid_unauth_pipelining=no
   -o smtpd_tls_security_level=encrypt
   -o smtpd_sasl_auth_enable=yes
   -o smtpd_tls_auth_only=yes
   -o smtpd_client_restrictions=permit_sasl_authenticated,reject
   -o smtpd_sender_restrictions=reject_sender_login_mismatch
   -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre
   -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination
#  -o local_header_rewrite_clients=static:all
#  -o smtpd_hide_client_session=yes
#  -o smtpd_reject_unlisted_recipient=no
#     Instead of specifying complex smtpd_<xxx>_restrictions here,
#     specify "smtpd_<xxx>_restrictions=$mua_<xxx>_restrictions"
#     here, and specify mua_<xxx>_restrictions in main.cf (where
#     "<xxx>" is "client", "helo", "sender", "relay", or "recipient").
#  -o smtpd_client_restrictions=
#  -o smtpd_helo_restrictions=
#  -o smtpd_sender_restrictions=
#  -o smtpd_relay_restrictions=
#  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
# Choose one: enable submissions for loopback clients only, or for any client.
#127.0.0.1:submissions inet n  -       y       -       -       smtpd
#submissions     inet  n       -       y       -       -       smtpd
#  -o syslog_name=postfix/submissions
#  -o smtpd_forbid_unauth_pipelining=no
   -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o local_header_rewrite_clients=static:all
#  -o smtpd_hide_client_session=yes
#  -o smtpd_reject_unlisted_recipient=no
#     Instead of specifying complex smtpd_<xxx>_restrictions here,
#     specify "smtpd_<xxx>_restrictions=$mua_<xxx>_restrictions"
#     here, and specify mua_<xxx>_restrictions in main.cf (where
#     "<xxx>" is "client", "helo", "sender", "relay", or "recipient").
#  -o smtpd_client_restrictions=
#  -o smtpd_helo_restrictions=
#  -o smtpd_sender_restrictions=
#  -o smtpd_relay_restrictions=
#  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
smtps	inet	n	-	y	-	-	smtpd
   -o syslog_name=postfix/smtps
   -o smtpd_tls_wrappermode=yes
   -o smtpd_sasl_auth_enable=yes
spamassasin	unix	-	n	n	-	-	pipe
	user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}	
#628       inet  n       -       y       -       -       qmqpd
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
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=${multi_instance_name?{$multi_instance_name}:{postfix}}/$service_name
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
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

If I will need to put here some Dovecot’s configs - let me know from which file in /etc/dovecot/conf.d/ directory 📂, okay? 😁

Thanks in advance! 😉

#selfhosted

threaded - newest

IsoKiero@sopuli.xyz on 31 Jul 15:59 next collapse

There’s various permission errors on the log file, I’d start from those. Also your dovecot configs seem a bit funny to me, usually mails are not stored to user home directories with dovecot, but instead somewhere under /var, likely you’ll want /var/vmail. Logfiles are pretty good with these tools, so pay close attention to those.

And take your time to understand what the config options actually do. Too permissive configurations will get your sever to every spamlist on the world pretty quickly.

xolatgames@programming.dev on 31 Jul 17:23 collapse

How can I prevent my server to put anything to spamlist? 🤔

communism@lemmy.ml on 31 Jul 16:52 collapse

Just reading the first logs you pasted, it tells you the answer there. You can’t receive emails because you’re trying to receive emails as root, and writing emails to the home directory. Dovecot doesn’t run as root so it can’t write to root’s home directory.

You would ordinarily not receive mail as root. Most people set up root to redirect to your actual user. Look into Postfix aliases.

Try emailing a non-root user. It should write to the inbox. I mean, without your Dovecot configs, I can’t tell if there’s anything else wrong with them, but from the errors it seems Dovecot would work if not for the permissions errors.

xolatgames@programming.dev on 31 Jul 17:21 collapse

Do you mean to don’t write some message to root@xolat.games? 🤔

But there’s the problem, if you mean this! I was try to write to hello@xolat.games, and I’ve already made separated user on my server for this, and have add it to mail group. But, despite on this, I guess that it still tries to put something to root user 🤷‍♂️

Try emailing a non-root user. It should write to the inbox. I mean, without your Dovecot configs, I can’t tell if there’s anything else wrong with them, but from the errors it seems Dovecot would work if not for the permissions errors.

But what’s the configs do you need? 🤔 Dovecot has about 20 separated configuration files! Do I will need to put each of them? 🤷‍♂️

communism@lemmy.ml on 31 Jul 20:47 collapse

Do you mean to don’t write some message to root@xolat.games? 🤔

You can, but most email servers redirect mail to root@xolat.games to some other user eg xolatgames@xolat.games. The root user usually does not have their own inbox.

I’m not sure why hello is trying to write to /home/root then, that’s your problem. Do you have any Postfix aliases set up? Check /etc/postfix/aliases (there’s a chance it’s in a different location; the output of postconf alias_maps will tell you where it is).

But what’s the configs do you need? 🤔 Dovecot has about 20 separated configuration files! Do I will need to put each of them?

Just post the output of doveconf -n. Redact any sensitive info.