Misc. fixes for SMTP, activity script