bugfix when sending email through smtp