Added support for other SMTP hosts. Refactored