extract ssl stuff out of smtp code