Fixing email functionality to use tls settings only if enabled on the SMTP server