Merge #153: Process persistent tempfiles and shell-command-injection-safe attachment filenames

Squashed commit of the following:

commit a631a24aa07647268e5cc6620e98f74a90f41cd9
Author: Gaute Hope <eg@gaute.vetsj.com>
Date:   Tue Oct 1 15:47:45 2013 +0200

    make sure attachment filename doesn't hold any special chars

commit 6b27400233269f44455604001e0624da43b8823a
Author: Gaute Hope <eg@gaute.vetsj.com>
Date:   Tue Oct 1 09:13:46 2013 +0200

    Revert "use block in mime-decode"

    This reverts commit b72eca22e78564e288846090dba2b4e1fe14b3a5.

commit b72eca22e78564e288846090dba2b4e1fe14b3a5
Author: Gaute Hope <eg@gaute.vetsj.com>
Date:   Tue Oct 1 09:07:57 2013 +0200

    use block in mime-decode

commit 2e3f31e436057a182ad9c8be8a42fab879cbd9d6
Author: Gaute Hope <eg@gaute.vetsj.com>
Date:   Tue Oct 1 09:05:08 2013 +0200

    lambda uses return (which is path)

commit 8bd6c7515d72df24c7bf45072986352481ce33a6
Author: Gaute Hope <eg@gaute.vetsj.com>
Date:   Fri Sep 27 22:03:05 2013 +0200

    store tempfile objects statically so that tempfiles are cleaned on process end