View previous topic :: View next topic |
Author |
Message |
upengan78 l33t
Joined: 27 Jun 2007 Posts: 711 Location: IL
|
Posted: Wed Sep 05, 2012 5:33 pm Post subject: Claws-mail processing for forwarding email - [SOLVED] |
|
|
Hi,
I am using claws-mail on Gentoo. I've configured my Nagios (monitoring server) to accept emails with specific subject line and take action acknolwdge the alerts. It works just fine. I receive an alert email, I forward it to a email address, edit the subject by appending 'abc xyz' and click send. Server receives it and ACKs the alerts.
I want to automatize this in claws-mail by use of Processing rule. I can do normal forwarding using a Resend/Forward processing Rule but I can't edit the subject this way. I need to edit the subject before forwarding it with an automatic rule.
Any idea how this can be done? I think 'execute' action in processing rule configuration could work but I am not sure what's the mechanism involved with execute action.
Any help is appreciated.
Thanks.
Last edited by upengan78 on Thu Sep 13, 2012 4:43 pm; edited 1 time in total |
|
Back to top |
|
|
Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1611 Location: U.S.A.
|
Posted: Wed Sep 05, 2012 10:07 pm Post subject: |
|
|
Have the rule make an external call to 'formail'.
http://linuxcommand.org/man_pages/formail1.html
The formail utility is provided as part of "mail-filter/procmail".
A slightly heavier but more powerful method would be to use either 'guimb' or 'sieve', which are part of "net-mail/mailutils". Both are kind of like using 'awk' but have a simple language specifically suited to mail filtering tasks. _________________
patrix_neo wrote: | The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it. |
|
|
Back to top |
|
|
upengan78 l33t
Joined: 27 Jun 2007 Posts: 711 Location: IL
|
Posted: Wed Sep 05, 2012 10:17 pm Post subject: |
|
|
BoneKracker wrote: | Have the rule make an external call to 'formail'.
http://linuxcommand.org/man_pages/formail1.html
The formail utility is provided as part of "mail-filter/procmail".
A slightly heavier but more powerful method would be to use either 'guimb' or 'sieve', which are part of "net-mail/mailutils". Both are kind of like using 'awk' but have a simple language specifically suited to mail filtering tasks. |
Thanks. I was attempting this using execute option in processing Rule feature of claws-mail. It's like this
execute "echo %F | sed 's/Subject: /Subject:MyText MyText2/'" forward 3 "forwading email address"
I am not sure if this'll work. I have to make one of my host go down and test this out.
I am going to try formail option if this execute action doesnt't work.
And, as you mentioned sieve, I am thinking if I should ust login to Email server where I can configure sieve to forward emails by modifying subject. Don't really want to play with sieve configuration as it took long time for me last time I wanted to use it for forwarding some emails based on Subject.
Anyways, I will update this thread on this goes. |
|
Back to top |
|
|
upengan78 l33t
Joined: 27 Jun 2007 Posts: 711 Location: IL
|
Posted: Wed Sep 12, 2012 3:49 pm Post subject: |
|
|
Sorry I didn't update for long time.
I tried the thing I mentioned earlier but it fails and fails badly as my client hung on me continuously and opened hundreds of email forwarding windows on the screen. Killing the claws-mail client helped.
I am going to look into formail now and if I can't get it to work then I will login to SMTP/IMAP server for Sieve plugin.
Thanks |
|
Back to top |
|
|
upengan78 l33t
Joined: 27 Jun 2007 Posts: 711 Location: IL
|
Posted: Thu Sep 13, 2012 4:42 pm Post subject: |
|
|
Hello,
Your hint was so helpful. Finally, following worked in my claws-mail client and my automation works as I expected.
execute "cat `echo %F` | formail -I \"Subject: MYTEXT Fw: \"%s\"\" -I \"To: ForwardingEmailAddress\" | /usr/sbin/sendmail -t"
Thanks so much! |
|
Back to top |
|
|
Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1611 Location: U.S.A.
|
Posted: Thu Sep 13, 2012 8:18 pm Post subject: |
|
|
Glad it helped. _________________
patrix_neo wrote: | The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it. |
|
|
Back to top |
|
|
|