Page 1 of 1

Forwarding emails in kmail

PostPosted: Sep 16th, '14, 23:09
by jiml8
I am looking for a tool. I'll write it if I have to, but it would be so much better if this tool already exists.

Basically, my kmail installation collects email from many different accounts, and runs all those emails through spam filtering. When it is done with the filtering, any email that is not spam is both placed in the inbox and forwarded to another email address, and that email address is the only one that my android phone checks. Thus, I receive only filtered emails on my mobile device, and I receive emails from all accounts while only setting up one account for the android to check.

This works fine, with the following issues: (1) all emails that the android receives are prefaced with [fwd] from kmail, and (2) all forwarded emails wind up in the sent folder for kmail. Both of these cause me extra work; when replying from the android I have to edit the subject header and make sure I have the right reply to header filled in, and in kmail I am (once or twice a day) deleting all the forwarded emails from the sent folder.

Now, it would be a lot nicer if, instead of my kmail filters doing a "forward to", they did a "pipe through", naming a tool that would handle the forwarding without attaching the [fwd] or storing the message in the sent folder. In the alternative, if there was a cron job that would periodically run and remove the forwarded emails from the sent folder, I could live with that; I don't often have to respond to an email from my android device; most of my traffic is information only.

If it weren't for akonadi, the cron job would be trivial; just grep for the right forwarding info and delete the file from the directory it is stored in. But the fact that there is a database involved makes it a lot trickier.

I'll write this tool if I have to. But by the time I have worked out all the details and properly handle all the headers, and so forth, I'll have a couple days in it and right now I'm busy and would rather not spend the time. Far better if I can find a tool that does the job already. I have searched and found nothing...but perhaps I just have not hit on the right keywords.

Does anyone have any ideas?

As a peripherally related comment, I'll just mention that I have installed opencloud on my NAS (which runs Nas4Free...a BSD-based package), and integrating Kontact with Opencloud proved to be a very simple process - akonadi explicitly supports opencloud - as did integrating my android with opencloud. Thus, my calendars and contacts are being automatically synchronized between kmail and my android (very helpful) without making use of third-party (spying and insecure) cloud services.

Re: Forwarding emails in kmail

PostPosted: Oct 9th, '14, 12:19
by wintpe
yes

sendmail

if its not obvious ill explain

sendmail is used to route mail all over the place (so is postfix, a sendmail replacement) .

postfix is often used where simple sendmail in inbound gateway is required, and the implementer wants something simpler to implement.

But sendmail has far more flexibility in its rewriting engine.

alot of people who use sendmail use m4macros to simplify its rule writting,

but under the hood the sendmail.cf contains the sendmail raw rules, and this is where the full power of sendmail lies.

The mail rewriting language can do all of what you are asking, but its a steep learning curve.

The O'riely sendmail book has all the detail.

there may already be a macro that suits your purpose exactly, saving you brain ache, but ultimatly if it does not do what you want exactly you can edit the rules directly.

This post will only open the door to the solution, still a bit of work to get what you want.

regards peter

Re: Forwarding emails in kmail

PostPosted: Oct 11th, '14, 22:21
by doktor5000

Re: Forwarding emails in kmail

PostPosted: Oct 14th, '14, 21:28
by jiml8
I did not think of sendmail...

I have torn my hair out in the past trying to configure it...I guess I should take another look at it for this purpose.