Bug 284274

Summary: kmail2 isn't able to send encrypted emails
Product: [Applications] kmail2 Reporter: Andreas Schneider <asn>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Severity: normal CC: f.hammer, grote, kde_bugs, lukas.fuernkranz, montel, q000te, rosso, sven, till2.schaefer, torbjoern.k, vallesroc, yngve, zuber
Priority: NOR    
Version: 4.8.4   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andreas Schneider 2011-10-17 15:05:57 UTC
Version:           4.7 (using KDE 4.7.2) 
OS:                Linux

kmail2 isn't able to send encrypted emails. It aborts with the error:

Could not compose message: General error

I'm able to send signed mails and decrypt messages. Only sending encrypting messages doesn't work. I tried to obtain debug messages but the question is which component I have to enable for this in kdebugdialog.

Reproducible: Always

Steps to Reproduce:
Write a mail, click on encrypt and try to send it.

Expected Results:  
Send encrypted messages
Comment 1 Laurent Montel 2011-10-17 15:23:34 UTC
Works fine here.
Need me info.
It's ok here
Comment 2 Andreas Schneider 2011-10-17 15:38:34 UTC
Do you know which debug number I have to enable to get more information?

kdebugdialog --fullmode doesn't provide a search.
Comment 3 Torbjörn K. 2011-11-05 11:08:05 UTC
For me, this error also appears unregularly with signed but not encrypted messages.

Each time, this occurs, I have to confirm this error message twice. If I rehit "send message" too early, this error reappears. After waiting two seconds after confirmation of this error message, the email is sent.

A search for the first part of this error message "Could not compose message" points to libmessagecomposer.po, which is finally thrown by kdepim/messagecomposer/composerviewbase.cpp in line 651.
The second part "General Error" is the error string of a KJob object.

KDE 4.7.3 rel10
Kmail2 4.7.3
(everything through openSUSE repo on openSUSE 11.4)
Comment 4 rosso 2011-11-24 13:52:29 UTC
I´m having similar issues and i can narrow the problem down to this:  

Kmail2 fails to encrypt mail using pubkeys that are not 'absolutely' trustworthy.

Case 1: 
I try to send an encypted mail to bob using the pubkey, he just gave me. When i hit the "send" button, Kmail opens a window telling me that "there is a problem" with the certificate and i should recheck. When i did recheck and hit the "ok" button, sending the mail fails due to a "general error". (that popup appears twice btw)

Case 2:
I sign the same key bob just gave me with my key first. When i encrypt a mail to   bob, everything works as expected. 

KMail 4.7.2, KGPG 2.6.1 on Kubuntu oneiric
Comment 5 Andreas Schneider 2012-02-04 11:11:40 UTC
This is still not fixed in KDE 4.8.
Comment 6 lukas.fuernkranz 2012-02-05 23:33:32 UTC
This problem occurs here as well, but only with keys I haven't signed (just like rosso explained). Do you have that problem as well with keys you already signed, asn?
Comment 7 Andreas Schneider 2012-02-06 09:01:18 UTC
Yes, it works if I signed the key.
Comment 8 lukas.fuernkranz 2012-02-06 13:54:56 UTC
Shouldn't we close this bug report and open an new one just like http://bugs.kde.org/44699 (take a look at the last message there)?
Comment 9 Sven Eden 2012-03-22 10:58:42 UTC
I have this issue since I set kmail2 to automatically encrypt messages if possible and to encrypt messages stored in the "sent" folder. It never is, because there are only two recipients in my list with keys for encryption, but it seems to affect the whole thing. After disabling both and restarting kontact, I do not get this error again.
Comment 10 Sven Eden 2012-04-10 11:02:17 UTC
(In reply to comment #9)
> After disabling both and restarting
> kontact, I do not get this error again.

Which was wrong. After another reboot the error is back although auto encryption is disabled. Automatic signing is enabled but was never an issue.
Comment 11 Sven Eden 2012-04-11 12:14:57 UTC
Just a little update:

I have completely deleted everything from nepomuk and akonadi (after backing up my e-mails, calendars, filters and so on of course) and recreated everything from scratch.

The problem remains. To send an e-mail I have to not only wait, but to restart different akonadi agents until it works.

This is how I fixed it: I now have not only disabled automatic encryption, but automatic signing, too. Now all e-mails get sent without any problems.

Unfortunately it is very important for some recipients that my e-mails are signed, so I do hope that this bug will be fixed somewhere in the not-so-far future.

Further: I have tried to debug this using the akonadi-console with enabled debugger. Before the mentioned error window pops up, the log looks fine. There is nothing failing. So it seems to be a problem somewhere between the composer and the key management. But I do not really know, I am, to be honest, completely at sea here.
Comment 12 F Hammer 2012-05-20 18:01:18 UTC
Same problem here, when i tried to send an encrypted mail via KMail 4.8.3 i get the message: "Error while composing the e-mail: common error". The messagebox pops up two times if this helps to debug. Anything else i can do to help debugging? 

It is really annoying that sending encrypted mails is broken in such a late release of KDE-4.8  :(
Comment 13 Yngve Levinsen 2012-06-11 12:36:04 UTC
Can confirm the same here, running Chakra GNU/Linux which is fairly up to date in the 4.8 series. I also got the error message twice (cannot save message: general error)

After I had signed the key (using the gpg in terminal, kgpg did not work for whichever reason), I did not have this problem anymore.
Comment 14 Roc Vallès 2012-06-23 23:28:57 UTC
Confirming this with kmail 4.8.4. It refused to work with this error until I signed the key I wanted to encrypt for.
Comment 15 Andreas Zuber 2012-08-20 06:45:32 UTC
Confirming this Bug.

- encryption and signing with trusted keys works.
- encryption and signing with untrusted keys fails with the error messages already mentioned.

KMail 4.8.3, Gentoo
Comment 16 Torsten Grote 2012-10-30 12:51:32 UTC
I can confirm this bug with latest master. But sometimes encrypting works. I also noticed that sometimes restarting kmail helps. Still, this bug is very annoying.
Comment 17 Andreas Schneider 2012-10-30 13:17:58 UTC
If you look a the source of emails from some KDE developers, they send mails with Thunderbird. Looks like a clear statement about kmail.
Comment 18 Christoph Feck 2012-10-30 21:16:52 UTC
Some KDE developers even use Firefox instead of Konqueror. I do not see a statement there, it is called "freedom of choice".
Comment 19 Yngve Levinsen 2012-10-30 21:37:48 UTC
I have to agree with you Christoph. I think it is healthy that developers of a given application at least sometimes use "competitors" applications. There is a lot of inspiration to be found by experiencing what others do right, and wrong.

In any case, this is very off topic, so let's discuss that somewhere else.
Comment 20 Torsten Grote 2012-12-04 09:47:53 UTC
In the meantime, I did some tests and it looks like that i can indeed encrypt mails to recipients whose key I fully trust, but not to recipients whose key I don't trust. Normally, there should be a dialog offering me to send anyway, but there's just a general error.
Comment 21 Torsten Grote 2012-12-22 12:18:38 UTC
This was getting on my nerves big time, so I debugged it and hope to have found a solution. I posted a review request for the developers here: https://git.reviewboard.kde.org/r/107847/
Comment 22 kde_bugs 2013-01-01 15:15:17 UTC
Confirm this bug for ubuntu 12.04 LTS with kmail2 version 4.8.5
Comment 23 Kevin Krammer 2013-03-02 17:53:12 UTC
Git commit c04f17ebd0e855bc7880f8a22dba8661d925f9e8 by Kevin Krammer, on behalf of Torsten Grote.
Committed on 23/02/2013 at 19:00.
Pushed by krake into branch 'master'.

Fix for sending encrypted mails to untrusted recipients

REVIEW: 107847

M  +8    -4    messagecomposer/composerviewbase.cpp
M  +1    -1    messagecomposer/encryptjob.cpp

Comment 24 q000te 2013-03-15 20:32:32 UTC
Finally. Thanks for the fix!

BTW: The corresponding bug within kmail1: https://bugs.kde.org/show_bug.cgi?id=44699
Comment 25 Till Schäfer 2013-08-12 14:24:20 UTC
was the patch backported to kde 4.10 ? In 4.10.5 it is still not working for me.