Enable DSN on Postfix

Continuing the discussion from Select notice of receipt automatically:

Imho the topic deserves a separate discussion, I want to come back to this and I’d be keen to hear your take on it

Totally agree with the last sentence

1 Like

cc: @filippo_carletti
cc: @giacomo

Hi guys,

Can we reactivate this topic?
Can we have DSN on NS 7.3?

TIA,
Gabriel

Could you try the options listed in the README above? If you find a working configuration, I’ll help to build an update.

Hi @filippo_carletti ,

I found more closer and detailed information regarding DSN.

https://www.howtoforge.com/configure-custom-postfix-bounce-messages
http://www.postfix.org/bounce.5.html

I hope I will be able to do something.
Thank you for your attention and support!

Gabriel

This is the procedure I used on a Nethserver NG 6.8


Create a template /etc/e-smith/templates-custom/etc/postfix/main.cf/99delaywarningtime

#
# 99delaywarningtime
#
# template custom
#
# delay_warning_time (default: 0h)
#
# The time after which the sender receives the message headers of mail
# that is still queued.
# To enable this feature, specify a non-zero time value
# (an integral value plus an optional one-letter suffix
# that specifies the time unit).
# Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks).
# The default time unit is h (hours).
#
#

delay_warning_time = 5m

Create a template /etc/e-smith/templates-custom/etc/postfix/main.cf/30bounceconfig

#
# 30bounceconfig
#
# template custom
#

bounce_template_file = /etc/postfix/bounce.cf

Create a file /etc/postfix/bounce.cf
(Put a empty line at the end of this file)

#
# The failure template is used when mail is returned to the sender;
# either the destination rejected the message, or the destination
# could not be reached before the message expired in the queue.
#

failure_template = <<EOF
Charset: us-ascii
From: MAILER-DAEMON (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail

This is the mail system at host $myhostname.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to <postmaster>

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system
EOF


#
# The delay template is used when mail is delayed. Note a neat trick:
# the default template displays the delay_warning_time value as hours
# by appending the _hours suffix to the parameter name; it displays
# the maximal_queue_lifetime value as days by appending the _days
# suffix.
#
# Other suffixes are: _seconds, _minutes, _weeks. There are no other
# main.cf parameters that have this special behavior.
#
# You need to adjust these suffixes (and the surrounding text) if
# you have very different settings for these time parameters.
#

delay_template = <<EOF
Charset: us-ascii
From: MAILER-DAEMON (Mail Delivery System)
Subject: Delayed Mail (still being retried)
Postmaster-Subject: Postmaster Warning: Delayed Mail

This is the mail system at host $myhostname.

####################################################################
# THIS IS A WARNING ONLY.  YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
####################################################################

Your message could not be delivered for more than $delay_warning_time_hours hour(s).
It will be retried until it is $maximal_queue_lifetime_days day(s) old.

For further assistance, please send mail to <postmaster>

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system
EOF


#
# The success template is used when mail is delivered to mailbox,
# when an alias or list is expanded, or when mail is delivered to a
# system that does not announce DSN support. It is an error to specify
# a Postmaster-Subject: here.
#

success_template = <<EOF
Charset: us-ascii
From: MAILER-DAEMON (Mail Delivery System)
Subject: Successful Mail Delivery Report

This is the mail system at host $myhostname.

Your message was successfully delivered to the destination(s)
listed below. If the message was delivered to mailbox you will
receive no further notifications. Otherwise you may still receive
notifications of mail delivery errors from other systems.

                   The mail system
EOF


#
# The verify template is used for address verification (sendmail -bv
# address...). or for verbose mail delivery (sendmail -v address...).
# It is an error to specify a Postmaster-Subject: here.
#

verify_template = <<EOF
Charset: us-ascii
From: MAILER-DAEMON (Mail Delivery System)
Subject: Mail Delivery Status Report

This is the mail system at host $myhostname.

Enclosed is the mail delivery report that you requested.

                   The mail system
EOF

I don’t know what is the command to reload the postfix configuration so I go in the dashboard, section Email then I change a parameter, I confirm the change then I restore the parameter and I save again… (I someon knows and wants to tell to me :slight_smile: )

Some test I do:

  • On Sogo: it seems that doesn’t work
  • On Thunderbird: there are some addons to manage that: https://addons.mozilla.org/it/thunderbird/addon/dsn-settings-2
  • On Outlook: I don’t know :slight_smile:
  • On Roundcube: “Settings” -> “Preferences” -> “Composing messages” -> Check “Always request a return receeipt” and “Always request a delivery status notification” but, when I made the tests, it seems that desn’t work

Some references and parameters here:
https://www.howtoforge.com/configure-custom-postfix-bounce-messages

Ciao
Nicola

3 Likes

Hi @saitobenkei ,

This part with the template is the easiest! I did that!
But is not enough!
There is something else to do, I think in /etc/postfix/main.cf, but till now I don’t know how and what.

Kind regards,
Gabriel

@GG_jr

Maybe I haven’t understand the thread but, one of my customers wants to manage DSN on the server.

I made those themplates and DSN works without other configurations.

What I didn’t understand?

You did this with NethServer?

I have created this template in /etc/postfix/bounce.cf.

Now, when I send an email from other mail server with DSN request to this NS mail server, that user receive a DSN confirmation but when I send from this NS mail server an email with DSN request to that mail server, I don’t receive nothing.
So, I need to receive DSN not only “to give” DSN. (“that mail server” has the ability “to give” and “to receive” DSN). And I don’t know how.

EDIT:

Don’t need to create a custom template for “bounceconfig” because in main.cf, the line “bounce_template_file = /etc/postfix/bounce.cf” already exist (at the end of the main.cf file).

NethServer v7.3 GUI: Status → Services → postfix (SMTP) → Restart button.
NethServer v7.3 CLI: # systemctl restart postfix.service

  • On SOGo: You don’t have “request DSN” option in web GUI (only “Return Receipt”). Same for WebTop 5 ( Mail: receipt button ).
  • On Thunderbird: This addon is for set permanently Request DSN.
    Without addon, you can ask for DSN for each email that you want to send, from here: Write → Option → Delivery Status Notification.
  • On Outlook 2013:
    Permanently: FILE → Option → Mail → Tracking: Enable “Delivery receipt confirming the message was delivered to the recipient’s e-mail server”.
    For each email that you want to send: New Email → OPTIONS → Enable " Request a Delivery Receipt".

Successfully Tested DSN.
Using Contribs (Koozali) Sme Server since 2008, just for DSN i came to nethserver ( it is not possible with Qmail)… thanks everyone

1 Like