issue #18983: moved in lots of connect code to reimplement emailing