Bug 89882

Summary: Use custom header fields with kmail composer from command line
Product: [Applications] kmail2 Reporter: Martin Steigerwald <Martin>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: ach, annma, julian, montel
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 4.11

Description Martin Steigerwald 2004-09-20 17:00:03 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Hello,

today I wanted to use the Debian reportbug program for the first time. Since I use KMail as my regular mailer I wanted it to use KMail instead of its own mailer or mutt for sending the bug report.

This cannot work. reportbug generates a mail file including headers and body of the email that can be send via "mutt -H" for example. mutt takes headers and body of the e-mail directly from the mail file.

From "kmail --help" I thought I could use "kmail --msg" for that purpose, but this doesn't work as KMail then puts the whole mail file including the header in the body of the new mail to be send. This is as it is documented when I try "man kmail". 

There does not seem to be an option to send a mail from a file and have KMail takes the headers and the body of the email out of the file. This essentially renders KMail unusable from applications that generate a complete e-mail in a file and want to send it via an external mail user agent.

Thus I would like an option to have KMail send a mail from a file which contains headers and body of the mail. A KMail compose window with all the headers and the body, well even attachments if any, should pop up and let me edit the e-mail before I sent it out. 

Regards,
Martin
Comment 1 Tom Albers 2004-09-20 17:06:27 UTC
Could you try File->Open in KMail?
Comment 2 Tom Albers 2004-09-20 17:14:07 UTC
*** Bug 89884 has been marked as a duplicate of this bug. ***
Comment 3 Tom Albers 2004-09-20 17:14:53 UTC
*** Bug 89885 has been marked as a duplicate of this bug. ***
Comment 4 Martin Steigerwald 2004-09-20 17:21:58 UTC
Sorry for the duplicates. I was on the wrong page of the bug tracking system and didn't recognize that before clicking. 

Although it doesn't show the file in the filerequester (maybe cause it doesn't end with a suffix for an e-mail file) I can open it by directly typing its filename. This works correctly as I can see. Anyway, here is that file contents - looks like a plain simple e-mail to me:

--------------------------------------------------------------------
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Martin Steigerwald <NOSPAM>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: kernel-image-2.6.8-1-686: Kernel doesn't boot on IBM ThinkPad T23
 laptop
X-Reportbug-Version: 2.63
X-Debbugs-Cc: NOSPAM

Package: kernel-image-2.6.8-1-686
Version: 2.6.8-3
Severity: important



-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-1-686
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro

Versions of packages kernel-image-2.6.8-1-686 depends on:
ii  coreutils [fileutils]         5.2.1-2    The GNU core utilities
ii  fileutils                     5.2.1-2    The GNU file management utilities 
ii  initrd-tools                  0.1.73     tools to create initrd image for p
ii  module-init-tools             3.1-pre5-6 tools for managing Linux kernel mo

-- no debconf information
--------------------------------------------------------------------

The file is named originally "/tmp/reportbug-3711-yv7lxE" originally. Owner and group is that of the user "martin" I am logged in with.
Comment 5 Tom Albers 2004-09-20 17:33:48 UTC
Ok. Great. Changed the subject and made it a "small" bug.
Comment 6 Martin Steigerwald 2004-09-20 17:43:43 UTC
Nah, that wasn't the original problem I am talking about. That KMail does not show the mail file from reportbug in the "File->Open" in the file requester is a side problem I came across during giving you additional info on the bug.

The original problem is that

kmail -msg /tmp/reportbug-3711-yv7lxE

puts the whole contents of the mail file (contents see above) in the body of the newly created e-mail shown in the compose window that opens. But I want KMail to take the e-mail headers in that file as what they are: e-mail headers.

I didn't find a way to have KMail open that file and take the headers as headers and the body as body. This is what would be required to use KMail with reportbug and any other applications that wants to send a mail whose headers and body are contained in a single e-mail file. 

So I just want KMail to be able take the body text and the headers and probably also attachments out from a mail file I pass on the command line. This might be a new command line option and menu entry or even better autodection (if it can be done safely): When there are e-mail headers take them.

I stumbled upon a similar problem before when I try to use KMail to view an e-mail file that contains header and body of the email. But this is worth another bug report probably. So I think we have three "bugs" here already ;-)
Comment 7 Martin Steigerwald 2004-09-20 17:47:19 UTC
BTW

kmail --view /tmp/reportbug-3711-yv7lxE

works as I would expect it for "kmail -msg" as well . It shows the e-mail and take the headers as headers and the body as body.

As "--msg" is documented in "man kmail" to only take a mail body maybe another command line option would be required. But anyway a message is a complete message for me and thus it might be wise to rename "--msg" to "--body" and let "--msg" take a whole mail file including headers and body.
Comment 8 Achim Bohnet 2004-09-20 21:25:27 UTC
I had the same problem, kmail can't handle mail 'templatefiles' that contains
header and body.   Last time I tried again I worte a script that
splits the header files into several --header "one" --header 'two' ...
can add the body via --body "long msg body".  Just to find that --header
seem to be ignored :(   At least sending myself a msg like:

	kmail --header "X-Test-Test: blabla" -s test  `whoami`

does not contain the X-Test-Test header field.

And I agree with Martin does new summary 'File->Open can not open files without suffix.'  does not describe the problem.   Better

	'no way to use custom header fields with kmail composer'

Best solution with IMHO to add a --msgfile that accepts header and body
in one template.   But a working --headere "some: thing"  would be at
least a first step.
Comment 9 Tom Albers 2004-09-20 23:30:10 UTC
Fair enough
Comment 10 Adam Porter 2006-01-07 21:43:31 UTC
*** This bug has been confirmed by popular vote. ***
Comment 11 Anne-Marie Mahfouf 2011-12-01 11:28:55 UTC
Reassigning to KMail2, please comment on the validity of this report against KMail2
Comment 12 Adam Porter 2011-12-01 14:56:26 UTC
Um, well...unless anyone has actively fixed the bug, shouldn't it
still exist in KMail2?

On Thu, Dec 1, 2011 at 05:28, Anne-Marie Mahfouf <annma@kde.org> wrote:
> https://bugs.kde.org/show_bug.cgi?id=89882
>
>
> Anne-Marie Mahfouf <annma@kde.org> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |annma@kde.org
>          Component|composer                    |composer
>            Product|kmail                       |kmail2
>
>
>
>
> --- Comment #11 from Anne-Marie Mahfouf <annma kde org>  2011-12-01 11:28:55 ---
> Reassigning to KMail2, please comment on the validity of this report against
> KMail2
>
> --
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are a voter for the bug.
Comment 13 Laurent Montel 2013-03-26 08:10:07 UTC
Git commit b03377f866e86d4c66b6527cf773064601cbe8fc by Montel Laurent.
Committed on 26/03/2013 at 09:09.
Pushed by mlaurent into branch 'master'.

Fix Bug 89882 - Use custom header fields with kmail composer from command line

FIXED-IN: 4.11

M  +3    -0    kmail/composer.h
M  +0    -1    kmail/kmail_options.h
M  +12   -0    kmail/kmcomposewin.cpp
M  +3    -0    kmail/kmcomposewin.h
M  +19   -20   kmail/kmkernel.cpp

http://commits.kde.org/kdepim/b03377f866e86d4c66b6527cf773064601cbe8fc
Comment 14 Martin Steigerwald 2013-03-26 09:48:16 UTC
Thank you, Laurent. I appreciate that you look at such old bug reports.
Comment 15 Laurent Montel 2013-03-26 11:02:55 UTC
I try to fix all bugs reported and this one was very old so  I worked on today.
Regards.