Looks like it was not getting $sender because I was using admin@mydomain as sender..
admin@mydomain does not have first name/last name so
SENDER=$(cat in.$$ | egrep -i '^From: .*>+'| cut -d '<' -f 2 | cut -d '>' -f 1) just cuts the e-mail out if there is no first name/last name.. I don't get why you're using "cut"..
I'm using:
SENDER=$(cat in.$$ | egrep -i '^From:' | sed 's/From: //g')
It works
