Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Claws-mail processing for forwarding email - [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 676
Location: IL

PostPosted: Wed Sep 05, 2012 5:33 pm    Post subject: Claws-mail processing for forwarding email - [SOLVED] Reply with quote

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
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1564
Location: U.S.A.

PostPosted: Wed Sep 05, 2012 10:07 pm    Post subject: Reply with quote

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.
_________________
"We can't expect the American People to jump from Capitalism to Communism, but we can assist their elected leaders in giving them small doses of Socialism, until they awaken one day to find that they have Communism." -- Nikita Krushchev
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 676
Location: IL

PostPosted: Wed Sep 05, 2012 10:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 676
Location: IL

PostPosted: Wed Sep 12, 2012 3:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 676
Location: IL

PostPosted: Thu Sep 13, 2012 4:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1564
Location: U.S.A.

PostPosted: Thu Sep 13, 2012 8:18 pm    Post subject: Reply with quote

Glad it helped. :)
_________________
"We can't expect the American People to jump from Capitalism to Communism, but we can assist their elected leaders in giving them small doses of Socialism, until they awaken one day to find that they have Communism." -- Nikita Krushchev
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum