The SMTP part of imap_roundtrip does not work
It fails trying to authenticate to the SMTP server, because the Go net/smtp library refuses to do PLAIN authentication on an un-encrypted connection.
Unfortunately, the connection is indeed encrypted (a *tls.Conn). The net/smtp code tries to autodetect TLS usage by checking if the net.Conn it got is actually a *tls.Conn:
_, c.tls = conn.(*tls.Conn)
but since we wrap the *tls.Conn in our logging wrapper, the above code fails, and net/smtp thinks our connection is unencrypted.
This is sad and appears to not have workarounds.