Fixes to mail sending