-
Notifications
You must be signed in to change notification settings - Fork 96
Auto Add Labels To New Messages
Hamish Downer edited this page Feb 16, 2013
·
4 revisions
You can use the before-add-message.rb
hook to add labels to messages as they
arrive.
before-add-message
------------------
File: ~/.sup/hooks/before-add-message.rb
Executes immediately before a message is added to the index.
Variables:
message: the new message
if message.from.email.start_with? 'bill.gates@microsoft'
message.add_label :microsoft
end
if message.recipients.any? { |person| person.email =~ /admin-.*@example.org/i }
message.add_label :admin
end
if message.recipients.any? { |person| person.email =~ /admin-.*@example.org/i }
message.remove_label :inbox
message.add_label :admin
end
subj = message.subj.downcase
if subj.start_with? '[sup-talk'
message.add_label :sup
end