Fixed bug in SMTP mail function