<some-command> | tee some.log ; \
( [[ ${PIPESTATUS[0]} -eq 1 ]] \
&& (tail some.log | mail -s '<some-command> exited with error' you@example.com) \
|| (tail some.log | mail -s '<some-command> finished' you@example.com) )
breakdown:
| tee some.log;