Not certain what I did but the following used to work and now it doesn't. I
have this:
1 #bit of spam control
2 if message.raw_header =~ /X-Spam-Flag: YES/
3 message.add_label :spam
4 log "Marking message #{message.id} as spam, subject is '#{message.subj}'"
5 end
6
7 addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
8 if ! addressfile.grep(/#{message.list_address.email}/).empty?
9 message.add_label :lists
10 end
in before-add-message.rb. At the moment that is all I have in there.
And this:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
in ~/.sup/hooks/label.lists.
If I state this: {message.list_address.email}
I get this:
[Tue Feb 15 09:32:21 -0500 2011] hook: error running
/home/plecavalier/.sup/hooks/before-add-message.rb: undefined method `email'
for nil:NilClass
[Tue Feb 15 09:32:21 -0500 2011] hook:
/home/plecavalier/.sup/hooks/before-add-message.rb:8:in `__run'
As you can see above line 8 is {message.list_address.email} in this case.
Unless, of course, '8' has nothing to do with the line number!?
If I state this: {message.list_address} all mail -not just the from the
addresses stated in the file- are labeled 'lists'.
I looked at the post[1] where Hamish helped me by suggesting I state
message.list_address.email to reference the list-post in the header and it
worked fine at that time. I continued to play aroudn with things to try and get
the hook to not only add 'lists' but add the relevant list name as well as
remove the 'inbox' label. That didn't work so I tried going back to basics and
just have the hook label the relevant mails as 'lists' and now I can't even do
that.
What Have I done to make this not work anymore?
ref
[1]http://rubyforge.org/pipermail/sup-talk/2011-February/004495.html
--
Thanks,
Phil
_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk