Bug 341457 - Kmail (Framework branch) inserts an additional To: and Subject: into the header upon sending emails.
Summary: Kmail (Framework branch) inserts an additional To: and Subject: into the head...
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: Git (master)
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-01 11:29 UTC by Raymond Wooninck
Modified: 2014-12-09 09:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix the header problem (533 bytes, patch)
2014-12-09 05:19 UTC, Dan O.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Wooninck 2014-12-01 11:29:08 UTC
I have build/installed the full KDEPIM suite from the Framework branch and am using akonadi-runtime from the master branch.  Everything seems to be working fine, however the only major issue is that upon sending emails the header block with the Addressees and Subject is duplicated. This causes that the sender (depending on his email client) sees a subject "missing subject" and multiple recipients are shown. 

Below is the paste of the email source that I send to myself:  

Return-Path: <tittiatcoke@gmail.com>
Received: from hqvmt44011.eur.cchbc.com ([80.108.147.43])
        by mx.google.com with ESMTPSA id gy8sm3160977wib.23.2014.12.01.03.16.34
        for <multiple recipients>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 01 Dec 2014 03:16:34 -0800 (PST)
From: Raymond Wooninck <tittiatcoke@gmail.com>
Subject: missing subject
To: tittiatcoke@gmail.com
Cc: raymond.wooninck@chello.at
To: "tittiatcoke@gmail.com" <tittiatcoke@gmail.com>
Cc: "raymond.wooninck@chello.at" <raymond.wooninck@chello.at>
Subject: Test
Date: Mon, 01 Dec 2014 12:16:25 +0100
Message-ID: <45755231.Umg0vT3hQL@hqvmt44011.eur.cchbc.com>
User-Agent: KMail/4.72 pre (Linux/3.17.2-1-desktop; KDE/5.5.0; x86_64; ; )
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

Test 

I am not sure if this is an issue of the sending akonadi resource (it happens with both IMAP and SMTP) or that it is kmail.  The issue is bad as that e.g. GMail itself bounces the email back with the indication: 
Final-Recipient: RFC822; <tittiatcoke@gmail.com>
Action: failed
Status: 5.1.1
Remote-MTA: dns; gmail-smtp-in.l.google.com (74.125.136.26)
Diagnostic-Code: smtp; 550-5.7.1 [62.179.121.43      12] Our system has detected that this message is
 550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail,
 550-5.7.1 this message has been blocked. Please visit
 550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&answer=188131 for
 550 5.7.1 more information. vf7si29786552wjc.81 - gsmtp



Reproducible: Always

Steps to Reproduce:
1. Use KMail based on Frameworks
2. Send an email 
3.

Actual Results:  
Email headers are "misformed" and causes rejections from email providers.

Expected Results:  
An email with a correct header is being send
Comment 1 Dan O. 2014-12-07 03:18:04 UTC
It looks almost as though it's a problem with Akonadi. I'm having this exact issue, though I also have duplicate From: headers. If I look at the source of the message sitting in the sent mail folder, it only has one set of headers. This leads me to believe that somewhere between the mail transport agent and the server the message is getting duplicated. This could even be related to duplicate signatures reported in bugs further down.

This is definitely a Kmail/Akonadi issue though, I can send mail using other MUAs just fine.

Another interesting thing of note for me is the subject header. The first header is missing the subject, the second one has it filled in.

From: Dan Oriani <dan@redchops.com>
Subject: missing subject
To: dan.oriani@gmail.com
From: Dan Oriani <dan@redchops.com>
To: "'dan.oriani@gmail.com'" <dan.oriani@gmail.com>
Subject: Look at these headers
Date: Sat, 06 Dec 2014 22:16:51 -0500
Comment 2 Dan O. 2014-12-09 03:38:19 UTC
Alright, tracked this one down, though I don't know why it does it. All I can do is make a super cheap hack to make it work, but I don't want to distribute it.

Whatever is sending the URL to SMTPProtocol::put()  is sending a malformed string. Instead of "headers=0" which would turn off header generation, it's sending "eaders=0" which isn't recognized by the smtp job creator, and is causing it to create new header information. I'll see if I can track down what is generating the URL and figure out why it's clipping the first character, but I certainly wouldn't be offended if somebody found it before me ;)
Comment 3 Dan O. 2014-12-09 05:19:35 UTC
Created attachment 89878 [details]
Fix the header problem

This patch fixes the parsing of the string passed to the SMTP KIO slave. It appears it was merely a typo, where the function should have read mid(-1) instead of mid(1). In any case, I have tested this on my machine and the headers are no longer duplicated.
Comment 4 Laurent Montel 2014-12-09 08:27:12 UTC
Ok I look at it.
I will create an unittest for this code and fix it.

Thanks for investigate it.
Comment 5 Laurent Montel 2014-12-09 09:13:36 UTC
Git commit 96e025878d2c62339600858046cc90a29cedbda8 by Montel Laurent.
Committed on 09/12/2014 at 09:11.
Pushed by mlaurent into branch 'master'.

Fix Bug 341457 - Kmail (Framework branch) inserts an additional To: and Subject: into the header upon sending emails.
Based on patch from  Dan O.

Add unittest for it.
QUrl query doesn't return "?...."
just query.
With KUrl it return "?..." => necessary to query().mid(1)

Merge remote-tracking branch 'origin/KDE/4.14'

Conflicts:
	kioslave/src/smtp/tests/requesttest.cpp

A  +1    -1    kioslave/src/smtp/request.cpp     [License: GPL (v2) (+Qt exception)]
A  +34   -1    kioslave/src/smtp/tests/requesttest.cpp     [License: GPL (v2)]
R  +2    -0    kioslave/src/smtp/tests/requesttest.h

http://commits.kde.org/kdepimlibs/96e025878d2c62339600858046cc90a29cedbda8
Comment 6 Laurent Montel 2014-12-09 09:14:22 UTC
@Dan O. thanks for investigate it.
I added unittest and fixed code.