Bug 3533

Summary: DSN (delivery status notification)
Product: Claws Mail Reporter: Gerard Seibert <gerard.seibert>
Component: SMTPAssignee: users
Status: RESOLVED PATCHESWELCOME    
Severity: enhancement    
Priority: P3    
Version: 3.12.0   
Hardware: PC   
OS: FreeBSD   
Attachments:
Description Flags
Enables Delivery Status Notification request
none
Add Delivery Status Notification (DSN) support
none
Add Delivery Status Notification (DSN) support
none
Add Delivery Status Notification (DSN) support
none
Add Delivery Status Notification (DSN) support
none
Add Delivery Status Notification (DSN) support
none
Add Delivery Status Notification (DSN) support
none
Add Delivery Status Notification (DSN) support none

Description Gerard Seibert 2015-10-05 12:06:42 CEST
Is it possible to add DSN (delivery status notification) to claws-mail? Some MUAs have that ability built in, like MS Outlook; however, I can find no easy way to do it in claws-mail.
Comment 1 Paul 2015-10-05 12:56:09 CEST
In the Compose window, set /Options/Request Return Receipt
Comment 2 Ricardo Mones 2015-10-05 13:21:06 CEST
(In reply to comment #1)
> In the Compose window, set /Options/Request Return Receipt

I think OP could be talking about RFC 3461 and related ones (which is currently not supported), not to RFC 3798 (Message Disposition Notification) which is the one of the return receipt feature. But I may be wrong, so I'll let him reopen if that's the case.
Comment 3 Gerard Seibert 2015-10-05 14:30:09 CEST
Yes, I am referring to RFC 3461. I am sorry, I probably should have mentioned that in my original post. This feature is supported by several MUAs. It should be fairly simple to implement since it only requires a simple addition to the message headers.

If there is no interest in adding this feature, feel free to close this report.
Comment 4 Paul 2015-10-05 14:38:48 CEST
(In reply to comment #3)
> It should be fairly simple to implement since it only requires a
> simple addition to the message headers.

In that case, please submit a patch.
Comment 5 Ricardo Mones 2015-12-28 14:57:24 CET
(In reply to comment #3)
> Yes, I am referring to RFC 3461. I am sorry, I probably should have
> mentioned that in my original post. This feature is supported by several
> MUAs. It should be fairly simple to implement since it only requires a
> simple addition to the message headers.
> 
> If there is no interest in adding this feature, feel free to close this
> report.

Given the RFC example¹ this is far from a "simple addition to message headers", it needs also a per-address UI, and at least one account property to start with.

But clean patches still welcome :)

¹ https://tools.ietf.org/html/rfc3461#section-10.1
Comment 6 Ricardo Mones 2016-02-16 12:13:39 CET
Reported also on Debian BTS: https://bugs.debian.org/814884
Comment 7 Alex Fedorov 2017-02-21 00:32:26 CET
Created attachment 1721 [details]
Enables Delivery Status Notification request

This patch adds the Delivery Status Notification request option to Claws Mail. When enabled, a catch-all (success, failure and delay) notification will be requested from server, along with copy of sent message headers.
Please note, that due to Claws Mail architecture it was found to be very difficult to add such option to compose message dialog, so instead a checkbox controlling the option was added to account properties, under the Send tab. As a result, a "request_dsn" property is added to accountrc config file.
Tested on 3.14.1, should work on git commit bbeb55d, but the latter does not compile due to unrelated bug.
Comment 8 Ricardo Mones 2017-02-21 09:45:44 CET
(In reply to comment #7)
> Created attachment 1721 [details]
> Enables Delivery Status Notification request
> 
> This patch adds the Delivery Status Notification request option to Claws
> Mail. When enabled, a catch-all (success, failure and delay) notification
> will be requested from server, along with copy of sent message headers.
> Please note, that due to Claws Mail architecture it was found to be very
> difficult to add such option to compose message dialog, so instead a
> checkbox controlling the option was added to account properties, under the
> Send tab. As a result, a "request_dsn" property is added to accountrc config
> file.
> Tested on 3.14.1, should work on git commit bbeb55d, but the latter does not
> compile due to unrelated bug.

Thanks for the patch, haven't tested it, but looks correct. Nevertheless, I think always sending the 3 types of DSN request is a bit inflexible: for some accounts you could be interested only in failures, for example. This can be solved with three additional checkboxes (with their sensitivity linked to main checkbox) and building the right part of NOTIFY= string from them. The UI could be something like this:

+-Request Delivery Status Notification--------------+
| [ ] Enable                                        |
| [ ] Failures [ ] Delays [ ] Success               |
+---------------------------------------------------+

No RET parameter is added to mail command¹, it's not worth to control which is returned on the DSN? 

No ENVID parameter is generated, maybe it's a good idea to generate one, and save it in Claws Mail special headers, so in the future you could track which DSN-requested messages have received the DSN or not.

There's also no special handling of received DSN multipart/report + message/delivery-status messages, though not sure what can be done with those.

Not sure if you're willing to improve the patch, in any case thanks in advance ;)

¹ https://tools.ietf.org/html/rfc3461#section-4.3
Comment 9 Olivier Brunel 2017-07-03 20:11:50 CEST
Created attachment 1764 [details]
Add Delivery Status Notification (DSN) support

Had a look at this recently, so here's a new patch. This is based on Alex Fedorov work - thanks! - and basically just changes UI things.

Specifically, the account option moved to Compose, and was split into 3 checkboxes as suggested: Success, Failure, and Delay.

Those options only set a default, which can itself be overwritten by similar options under folder properties, page Compose.
Either way, a new menu in Compose window will show the current options as well as allow to set them on a per-message basis.
Comment 10 Olivier Brunel 2018-08-28 18:21:34 CEST
Created attachment 1909 [details]
Add Delivery Status Notification (DSN) support

Bumping this with a rebase on 3.17 :)
Comment 11 wwp 2018-08-29 00:32:32 CEST
Good! Why not defaulting to Failure+Delay in folder properties as it's done in account prefs and compose window?
Comment 12 Olivier Brunel 2018-08-30 17:50:20 CEST
(In reply to comment #11)
> Good! Why not defaulting to Failure+Delay in folder properties as it's done
> in account prefs and compose window?

First off, it's only done in account prefs. What you see in the compose window is what will be applied to that mail, and taken from either the folder properties if any, else the account prefs -- IOW this isn't a default that's hard-coded anywhere in the code, it's loaded from user settings.

Now, why not defaulting to Failure+Delay in folder properties as it's done in account prefs? Well, would that be a question or a suggestion?

If the former, I believe my thinking was that the account pref feels more like a "general" setting (trying not to say "user default" here to avoid confusion), where sensible (hard-coded) defaults are good to have, while folder properties felt more like a specific/"restricted" override of said general setting, thus it was less important/better as blank.
I also wonder if there couldn't be "confusion" regarding whether those values were hard-coded defaults or "imported" from an account prefs, and again leaving it "blank" felt both simpler & easier. :)

If the later, sure, I could do that.
Comment 13 wwp 2018-08-30 17:57:46 CEST
Thanks for elaborating. Formerly it was a question (to know if it was a bug or made on purpose, then what purpose?); but it's also a suggestion since I think it would be more consistent to use the same defaults in every place; and I don't think we apply strict options in some place and loose ones in other places for the same feature, elsewhere in CM. Anyway, that is not a big deal at all.
Comment 14 Olivier Brunel 2018-08-30 18:27:55 CEST
Created attachment 1910 [details]
Add Delivery Status Notification (DSN) support

v2: Set proper defaults on folder property
Comment 15 Olivier Brunel 2018-09-05 19:23:52 CEST
Created attachment 1912 [details]
Add Delivery Status Notification (DSN) support

v3: compose: Update current options when changing account

Makes things more consistent with other similar options (e.g. auto-Cc, Privacy System, ...)
Comment 16 wwp 2018-09-14 23:35:46 CEST
Created attachment 1915 [details]
Add Delivery Status Notification (DSN) support

Update of the v3 to build against 3.17.0git53
Comment 17 wwp 2018-11-23 08:53:12 CET
Created attachment 1935 [details]
Add Delivery Status Notification (DSN) support

Updated to compile against -git176 (2018-11-23).
Comment 18 wwp 2018-11-23 11:30:13 CET
Created attachment 1936 [details]
Add Delivery Status Notification (DSN) support

Fixes missing diff hunks for compose.h and prefs_folder_item.c, and fix widget layout packing in prefs_account.