[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Automating email forwarding using kmail 1.13.7 (on Wheezy)



<sending to debian-user as my go to maillist, I may look for a kde list later>

See the section labeled  <update, my intended approach>-- I think I've picked 
a direction to work on, but am sending this anyway in case someone has a 
better solution or for documentation of the problems I ran into.  As it is for 
old versions of kmail, xdotool, and dbus, it may not have much value.

I'm using kmail 1.13.7 on Wheezy using pop3 (and mbox, mostly).  Kmail fetches 
the mail directly (and does the filtering) -- I don't use procmail or anything 
like that (and don't especially want to go back and insert procmail into the 
mail flow ahead of (or behind?) kmail, although I guess maybe I'd consider 
trying it behind kmail (that is, if it is possible, setting it up to pick out 
certain emails from a kmail mbox and forwarding those -- see below).

Goal: I get some emails that I want to forward to a select group of friends 
and relatives on a regular basis (at least daily).

I'd like to automate it somehow, in kmail I have an address group set up with 
the addresses to forward to, but it still takes 15 keystrokes (with a pause 
after the first to wait for kmail -- maybe pauses are required after others, 
but I don't notice those).

<update, my intended approach>
Oh, update: after thinking about it some more, I realized / remembered that  
11 of those keystrokes relate to overcoming what I consider a bug in kmail's 
addressbook (in 1.13.7) which doesn't allow me to give a name to a group of 
email addresses.  I know I can reduce that to 7 keystrokes, and maybe I can 
even get it to zero, which would give me a 4 keystroke and 1 pause solution, I 
guess I'll work in that direction and settle for that.

I may send this to debian-user anyway, maybe someone will have a better 
suggestion, or this may help somebody else (like avoiding xdotool or dbus for 
kmail (1.13.7)) 

I guess I should describe that bug with the kmail addressbook a little better, 
it is almost a two-pronged problem, and I'll probably work on that 
description, at least in my own notes>
</update, my intended approach>

I've tried a few approaches:

    * xdotool: I got it to almost work, but there is something drastically 
wrong in that the pauses between keystrokes are on the order of 12-15 or more 
seconds (instead of what the man page says is the default, 12 ms).  (I didn't 
actually time the delay between keystrokes, just a guess that maybe there is a 
bug that makes the 12 be timed in seconds instead of milliseconds).  I did try 
setting --delay to a much lower value (hmm, but I didn't try anything like 
0.012 -- maybe I will).  The problem is that, while xdotool is running, my 
system is locked up (I mean, for example, I can't switch to another desktop to 
do something else.)  

    ok, tried the 0.012 delay, didn't help.  (And after about 7 minutes, I was 
given the option to kill kmail (~"kmail is not responding"), and I killed it.

   * dbus: (Aside: I did something with klipper and dcop several years ago, 
but I never find much good documentation about it (or dbus).)  I got a few 
things to partially work (I can identify the kmail (composer) subwindow that 
has the email that I want to forward, but I haven't found the function(s) to 
enter a new set of addresses in the To: field.  

   (I did find a command to create a new email from scratch in a new composer 
window and fill in the fields like To:, CC:, BCC:, Subject:, but I don't see how 
to do that for an existing window.  

   If I really wanted to pursue this, I suppose a next step could be to 
download the source code for kmail 1.13.7 and then look for a method(s) in 
that code, and then hope that I can invoke those methods with dbus.  (I don't 
know / remember if dbus can invoke any method / property in an application 
with a dbus interface, or if the developer has to do some setup to make a 
method / property invocable by dbus.  In any case, that is further than I plan 
to go.

So I'm looking either for help with dbus or xdotool (I will try the --delay 
0.012), or some other approach.

Oh, a key (no pun intended) constraint is the 15 keystrokes and one pause that 
I can do currently, I'd like to have a 1 or 2 keystroke solution, and 
certainly nothing that takes 15 keystrokes (or more).

Now, me brainstorming for a minute (or trying to): 

I suppose I could try to somehow use a command line mailer.  I'd have to 
designate the email to be forwarded, probably get it into a file (my version of 
kmail does allow maildir folders, so maybe I could create one, then move the 
email I want to forward into that folder, then find the filename for that email, 
and feed that to a script that could (using awk, sed, perl or something) 
change the To: addressees and then mail it using a command line mailer.

I'm not sure what I'd have to do to set that command line mailer up -- 
currently kmail acts as what I call a Windows style mail client -- it handles 
the interface with my ISP to send emails (via SMTP) and get emails (via pop3).

Suggestions?  (Oh, I do have buster and jessie installations (on other 
computers), but my "daily driver" (to handle my normal activities) is this 
Wheezy system.  Someday I will migrate those activities to Buster or Jessie, 
but not in the near future -- I just don't want to take the time to do that 
now.






Reply to: