Your question isn't clear. But from what I understood this maybe what you're looking for
Code:
if [ $mailfrom = "domain.com" ]
then
# do something
else
# do something else
fi
To get the domain part you may do something like this
Code:
mailfrom=$(echo user@domain.com | cut -d '@' -f 2)
Hope this helps.