Use setup mail with better checking.

Updated pipelines to use setup mail function. Also made plotting code
prettier.