attachment functionality added to email function