Bug 286793 - kmail2 cannot spool mail from /var/spool/mail/$USER to inbox
Summary: kmail2 cannot spool mail from /var/spool/mail/$USER to inbox
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: MBox Resource (show other bugs)
Version: 4.9
Platform: OpenSUSE Linux
: NOR normal with 148 votes (vote)
Target Milestone: ---
Assignee: kdepim bugs
Depends on:
Reported: 2011-11-16 18:30 UTC by Roman Fietze
Modified: 2019-03-26 15:01 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Roman Fietze 2011-11-16 18:30:56 UTC
Version:           4.7 (using KDE 4.7.3) 
OS:                Linux


I cannot add /var/spool/mail/$USER as receive account, so it spools mail from there to inbox as it was possible with older versions of KMail.

Instead a new Folder is created with the name of the receive account.

Receiving mail spooled e.g. by fetchmail ans postfix is *the* feature of every known MUA.

Reproducible: Always

Steps to Reproduce:
Add receive account, mbox, any name.

Actual Results:  
New folder named as the receive account.

Expected Results:  
Allows me to spool directly to inbox.
Comment 1 Terry 2011-11-17 11:52:16 UTC
This is confirmation. kmail2 is the only MUA in the history of SMTP on *nix systems that cannot receive email via a standard mbox.


Comment 2 Christophe Giboudeaux 2011-11-18 10:57:11 UTC
(In reply to comment #1)
> This is confirmation. kmail2 is the only MUA in the history of SMTP on *nix
> systems that cannot receive email via a standard mbox.

What do you confirm exactly ? This bug report is not about smtp and also not about mails not appearing in kmail...

adding a mbox account pointing to /var/spool/mail/$USER works correctly
Comment 3 Roman Fietze 2011-11-18 14:15:21 UTC
(In reply to comment #2)

> What do you confirm exactly ? This bug report is not about smtp and also not
> about mails not appearing in kmail...

Yes and no. If you receive mail via SMTP and e.g. postfix and any local delivery agent, then thsi mail will be always spooled in /var/spool/mail. So we have to be able to use that "feature".

> adding a mbox account pointing to /var/spool/mail/$USER works correctly

Oh, sure. But you can not move that mail automatically to the inbox as older versions of KMail could do it, and any other MUA that I know can do it. Adding this mbox always creates a new folder.

The requirement is simply, that mail from the spool mbox ends up in the inbox as all mail, e.g. from IMAP or POP3 does.

And in my tests, but I think this is another bug which might be fixed already, you couldn't even remove mails from that folder. They reappeared when you quit and started KMail again.
Comment 4 S. Umar 2011-11-22 16:55:48 UTC
This is really a problem for me too since I run my mail server I get all my mail into /var/spool/mail/USER mbox. Isn't there a way to add a feature to direct this to inbox and be able remove those messages from the server?
Comment 5 Graeme Hewson 2012-01-11 12:29:02 UTC
Adding some more details to the report:

Add new Mbox account specifying Filename /var/mail/$user
    (on Kubuntu, /var/spool/mail is link to /var/mail)
Optionally change Display Name (default is $user)
Leave other settings as default, in particular:
    Enable file monitoring
    Compact every 50 messages
    Lock method None

Use mailx to send message to $user
Get several occurrences of these messages in Notifications:

    $user: The MBox file was changed by another program. A copy of the
    new file was made and pending changes are appended to that copy.
    To prevent this from happening use locking and make sure that all

    $user: The file 'file:///var/mail/$user' was changed on disk while
    there were still pending changes in Akonadi. To avoid data loss, a
    backup of the internal changes has been created at

[Is it possible to see the complete text of a popup message in Notifications?]

Delete message (move to wastebin)
Use mailx to send another message to $user
Get notifications as above
Both messages appear in Kmail folder (the first message was deleted, but has re-appeared).

It's possible to stop deleted messages from re-appearing by changing the "compact every" setting to 1 message.

It's not possible to stop the error messages from appearing when mail is sent to $user. Kmail1 has FCNTL locking, but Kmail2 doesn't. None of the other lock methods in Kmail2 (Procmail or Mutt) are applicable.

Also, Kmail1 has a Destination Folder setting for an account, but this isn't available in Kmail2.
Comment 6 Pavel Vasin 2012-02-02 05:00:57 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Dieter Jurzitza 2012-05-21 16:53:26 UTC
Hi folks,
any progress on this one? The behaviour of kmail2 is really not good in this regard. I have been "googling" around but did not find any reliable hint - on top of this, emails get lost or don't get removed from /var/spool/mail/<username> ....

Thank you for looking into this. Hopefully the old structure will be provided again - it was working since decades and it used to work like a charm.

Take care

Dieter Jurzitza
Comment 8 Roman Fietze 2012-06-10 11:54:39 UTC
In the meantime, after a few months we are already at KDE 4.8.4, kmail2 seems to handle an mbox file or account properly in terms of deletion and compaction.

But still, when I add a filter with "To:" matching regexp ".*", "Move into folder" "inbox", "From checked accounts onlY and "Spool" (which is my /var/spool/mail/$USER mbox account), then kmail2 does not apply this filter to incoming mail on the mbox account. But when I select a mail manually and apply all filters, it works, and the mail is move to inbox.

So there's still no workaround for this bug and I'm stuck with KDE 4.6 (and therefore openSUSE 11.4), until I drop KDEPIM.
Comment 9 Dieter Jurzitza 2012-06-10 14:20:03 UTC
Hi Roman,
I have a better solution (for now ...) download, build and install kdepim from openSUSE 11.4 on openSUSE 12.1. I've been putting all kmail2 stuff into the trash can until the simple things like automatic delivery into my inbox (why the heck has this been changed? What sense does that make? Why rise the need to apply filters for nothing but get you incoming email to where everybody I could ever think of would expect it to be?). If that will not be working any more kmail gets simply unusuable for me and I'll have to switch to another email client.
My two cents, maybe the aforementioned solution can be of help for someone (only for now, but anyway).
Take care

Dieter Jurzitza
Comment 10 Salvo "LtWorf" Tomaselli 2013-04-26 09:39:55 UTC
I can confirm the bug, the migration wizard created 2 separate resources, which is not at all what I wanted.
Comment 11 Roberto Maurizzi 2014-06-08 12:19:30 UTC
Still no news I assume...
BTW is this really Kmail2 related? I'd think Akonadi is now managing the mail resources.
Comment 12 Kevin Krammer 2014-06-08 13:37:46 UTC
As far as I can tell this works with either using the MBox folder as the target mail folder (default) or any other folder (using a filter).

While I myself use the spool file as a folder directly, moving or deleting mails as needed, one can also set up a filter and treat the spool file more like a POP3 account.

Just verfied this using a filter with:
* applies to incoming mails
* move to ... and selected a folder in my local maildir
* enable the filter only for the spool account (advanced filter settings)

Also changed the MBox resource's settings to compact on "1 Message"

Testing with mailx this is what happens:
* the mail appears in the selected target folder
* the spool file is of zero length

KMail inside Kontact 4.12.4
Comment 13 Martin Koller 2015-01-24 13:13:21 UTC
I again verified this with KDE 4.14.3 and it works as Kevin said.
Therefore closing.