Bug 2471

Summary: Make setting an X-Mailer header optional
Product: Claws Mail (GTK 2) Reporter: Fabian Keil <fk>
Component: OtherAssignee: users
Status: RESOLVED FIXED    
Severity: enhancement CC: cwallace
Priority: P3    
Version: 3.7.10   
Hardware: PC   
OS: FreeBSD   
Attachments:
Description Flags
Add a per-account option to set the X-Mailer header
none
Do not suppress the 'Generate X-Mailer' option for new IMAP accounts none

Description Fabian Keil 2011-08-06 16:26:05 UTC
Created attachment 994 [details]
Add a per-account option to set the X-Mailer header

The attached patch makes setting an X-Mailer header optional.
The option is enabled by default so if the option isn't touched
claws-mail's behavior shouldn't change.

It's already possible to overwrite the header with a custom value,
but it doesn't seem to be possible to set no X-Mailer header at
all.

The patch contains an IMAP-only code path which I didn't test
as I don't use IMAP.
Comment 1 Holger Berndt 2011-08-06 19:28:57 UTC
I don't see why that would be an enhancement, but anyways .. you can just add a custom X-Mailer header and leave it empty.
Comment 2 Fabian Keil 2011-08-07 12:09:50 UTC
It's an enhancement for users who prefer not to sent a non-standard header whose use is "not in general recommended" (RFC2076).

Overwriting the header's value with an empty value might be a work-around to prevent Claws-Mail from disclosing unnecessary information, but the header still appears in the message.

It's also my impression that header values aren't optional (RFC822).
Comment 3 Paul 2011-08-07 18:10:53 UTC
Fabian,
Why is it that you don't want this header to appear?
Comment 4 Holger Berndt 2011-08-07 18:17:15 UTC
> It's also my impression that header values aren't optional (RFC822).

That's a bit like saying "It's my impression that eating ice cream is forbidden (see the law)". I.e.: If you want to support your claim with a RFC, it'd be useful to give more detail.
Comment 5 Fabian Keil 2011-08-08 19:59:42 UTC
Paul, I think the question should be:
Why would I want the header to appear?

It's neither required nor recommended and by default it
discloses unnecessary information. If you redact it as much
as possible you end up with an value-less header and sending
an value-less header seems pointless so you might as well
not set it at all.

I'd actually consider not setting the header a great default,
but as I had no illusions that a patch for that would be
accepted, I didn't bother to submit one.

Holger, looks like I misread section 3.2, sorry.

Given that the patch has already been rejected and that
there are other patch and bug submissions deserving attention
discussing the patch any further seems like a waste of time.
I'll just keep it in my custom patch set.

Thanks for your time.
Comment 6 Chad Wallace 2011-08-08 22:37:02 UTC
+1 to this patch.  Claws-mail doesn't need to be adware.
Comment 7 Paul 2011-08-09 05:46:53 UTC
Fabian,
Countering a question by another question isn't really an answer! But from what I understand, you want to remove everything which is not 'required' and not specifically stated as 'recommended'. Am I right that it is everything or just this header?

Chad,
I think calling it 'adware' is not only harsh, but also a total misuse of the term 'adware'. It is clearly not this.
Comment 8 Fabian Keil 2011-08-12 12:00:52 UTC
There are indeed other unnecessary information "leaks" I intend
to eventually address (and probably some more I'm not aware of),
but I don't think they are relevant here.
Comment 9 Ricardo Mones 2011-08-12 14:41:08 UTC
FWIW I share the feeling that a X-Mailer (or for the case any other X-<something>) header which the user has set an empty value explicitly should not be generated at all. And that would solve the problem, if I didn't read wrong.

On the other side making this a per-account option is a bit overkill ;-P
Comment 10 Colin Leroy 2011-08-12 16:48:01 UTC
Would everyone be happy if empty custom headers were not inserted ?
Comment 11 Brian Morrison 2011-08-12 17:26:26 UTC
It's a neat solution Colin, if there is no information in the header there's no point inserting it.
Comment 12 Paul 2011-08-12 20:05:26 UTC
Adding a header so that the header doesn't get added doesn't quite make sense to me.
Comment 13 Ricardo Mones 2011-08-12 21:24:51 UTC
I agree just a checkbox "Disable X-Mailer header" makes probably more sense, and that also solves the problem, but requires more code ;-) I just tried to find the quickest way with the existing codebase.
Comment 14 wwp 2011-08-12 21:58:40 UTC
Agreed on not inserting empty custom headers, it makes senses and IMO that's how users will undertand it.
Comment 15 Fabian Keil 2011-08-13 13:54:31 UTC
I agree that having to add an empty header so the header
isn't actually added is a bit non-intuitive, but I think
any mechanism that gives the user control over setting
or not setting the X-Mailer header would be an improvement.

BTW, default header removal also works this way in curl
which is why I tried the same in claws-mail before writing
the patch.
Comment 16 users 2011-08-29 08:14:04 UTC
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:
http://www.colino.net/claws-mail/

2011-08-29 [colin]	3.7.10cvs4

	* src/compose.c
		Don't insert custom headers that have empty values.
		Allows not inserting X-Mailer if it's set to nothing.
		Fixes bug #2471, "Make setting an X-Mailer header optional".

2011-08-29 [colin]	3.7.10cvs3

	* src/image_viewer.c
	* src/textview.c
	* src/gtk/gtkutils.c
	* src/gtk/gtkutils.h
		Handle EXIF orientation in images (both in textview's
		preview and image viewer)
Comment 17 users 2011-08-29 13:01:35 UTC
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:
http://www.colino.net/claws-mail/

2011-08-29 [colin]	3.7.10cvs5

	* src/account.c
	* src/compose.c
	* src/prefs_account.c
	* src/prefs_account.h
		Revert cvs4 which is rather illogical and instead
		use Fabian's patch from bug #2471
Comment 18 Fabian Keil 2011-09-03 12:00:15 UTC
Created attachment 1005 [details]
Do not suppress the 'Generate X-Mailer' option for new IMAP accounts

As Okra Son reported on users@lists.claws-mail.org,
the patch didn't properly deal with IMAP accounts
(because, as Colin pointed out, I used the wrong code
as example).

This has been partly addressed by Colin in 3.7.10cvs7,
but the option still seems to be suppressed for new
IMAP accounts.

The attached patch (against  3.7.10cvs15) fixes this and
also removes the apparently redundant gtk_widget_show()
calls.

After the patch the code should be similar to the one used
for the "Send account mail address in Message-ID" option
which is probably a more fitting example.
Comment 19 Fabian Keil 2011-12-28 18:53:15 UTC
Looks like 3.8.0 is missing the "Do not suppress the 'Generate X-Mailer'
option for new IMAP accounts" patch, which still applies cleanly.
Comment 20 Paul 2011-12-28 19:22:34 UTC
It's there. See the 'Send' page of the IMAP account prefs for the 'Generate X-Mailer header' option
Comment 21 Paul 2011-12-28 19:24:27 UTC
Ok, i was too quick - you are right: the option does not appear in the options on the initial new account
Comment 22 Paul 2011-12-28 19:34:36 UTC
That's now fixed at v.3.8.0cvs7
Comment 23 Fabian Keil 2011-12-29 17:40:42 UTC
Thanks, Paul.