How to customize dovecot reject message


I’ve set a specific email address through roundcube to reject every message, added a text message, but the system is adding at the very top of the body this string:

Your message to specific_email@mydomain.neth was automatically rejected:

I would like get rid of it. So after a little search I’ve found that the template of this message should set on:


in fact I see there:

#rejection_reason_test = Your message to <%t> was automatically rejected:%n%r

well I changed as desired, of course I restarted the service, and even the server… but nothing to do still the system put that line on top of body message.

Any idea how to fix this?

thanks for reading

Did you remove the comment mark ‘#’ for that line (your customized one)?
Hope you don’t mind asking such simple question.

Hi Marc,

every single line in the file is commented with one single “#” but the three head lines not, there are two #, so I assumed that for comment should use ## not #, the file is like this:

## LDA specific settings (also used by LMTP)

# Address to use when sending rejection mails.
# Default is postmaster@<your domain>. %d expands to recipient domain.
#postmaster_address =

# Hostname to use in various parts of sent mails (e.g. in Message-Id) and
# in LMTP replies. Default is the system's real hostname@domain.
#hostname = 

# If user is over quota, return with temporary failure instead of
# bouncing the mail.
#quota_full_tempfail = no

# Binary to use for sending mails.
#sendmail_path = /usr/sbin/sendmail

# If non-empty, send mails via this SMTP host[:port] instead of sendmail.
#submission_host =

# Subject: header to use for rejection mails. You can use the same variables
# as for rejection_reason below.
#rejection_subject = Rejected: %s

# Human readable error message for rejection mails. You can use variables:
#  %n = CRLF, %r = reason, %s = original subject, %t = recipient
#rejection_reason = Your message was automatically rejected%n%r
##rejection_reason_test = Your message to <%t> was automatically rejected:%n%r

# Delimiter character between local-part and detail in email address.
#recipient_delimiter = +

# Header where the original recipient address (SMTP's RCPT TO: address) is taken
# from if not available elsewhere. With dovecot-lda -a parameter overrides this. 
# A commonly used header for this is X-Original-To.
#lda_original_recipient_header =

# Should saving a mail to a nonexistent mailbox automatically create it?
#lda_mailbox_autocreate = no

# Should automatically created mailboxes be also automatically subscribed?
#lda_mailbox_autosubscribe = no

protocol lda {
  # Space separated list of plugins to load (default is global mail_plugins).
  #mail_plugins = $mail_plugins

btw I’ve tried to uncomment that line, just because… nothing happened… still default message there.

Single ‘#’ are also comments. Parameters/variable names cannot be changed.

rejection_reason = Il tuo messaggio è stato automaticamente rifutato%n%r

1 Like

The /etc/dovecot/conf.d directory isn’t configured as config dir in the templated dovecot.conf so it’s never read.
Enabling the conf.d directory leads to errors that are coming from the other conf files so I think the better way is to add a custom template to write the wanted rejection reason to /etc/dovecot/dovecot.conf

Create custom template dir:

mkdir -p /etc/e-smith/templates-custom/etc/dovecot/dovecot.conf

Write the wanted (empty) rejection_reason to the template fragment:

echo "rejection_reason = " > /etc/e-smith/templates-custom/etc/dovecot/dovecot.conf/90rejection

Apply the configuration:

signal-event nethserver-mail-server-update

Check dovecot config:

doveconf | grep rejection


Thanks Markus, that worked like a charm!

but, now the custom message set on roundcube is ignored. Any Idea how to abilitate it again?

Just add %r to the rejection_reason, this will add the custom Roundcube message:

echo "rejection_reason = %r" > /etc/e-smith/templates-custom/etc/dovecot/dovecot.conf/90rejection


signal-event nethserver-mail-server-update



1 Like