GOOGLE
first log in to ur mail
goto "mail settings"
switch to tab "filters"
create a new filter
give the information & go to "Next step"
choose the action and "create filter"
YAHOO
first log in to ur mail
goto options -> more options
switch to "filters"
"add filter"
fill the reqiured info
"SAVE CHANGES"