Added type option to mail().