• Mike Andrews's avatar
    net/smtp: set ServerName in StartTLS, as now required by crypto/tls · a18bfb8c
    Mike Andrews authored
    the crypto/tls revision d3d43f270632 (CL 67010043, requiring ServerName or InsecureSkipVerify) breaks net/smtp,
    since it seems impossible to do SMTP via TLS anymore. i've tried to fix this by simply using a tls.Config with
    ServerName, instead of a nil *tls.Config. without this fix, doing SMTP with TLS results in error "tls: either
    ServerName or InsecureSkipVerify must be specified in the tls.Config".
    
    testing: the new method TestTlsClient(...) sets up a skeletal smtp server with tls capability, and test client
    injects a "fake" certificate allowing tls to work on localhost; thus, the modification to SendMail(...) enabling
    this.
    
    Fixes #7437.
    
    LGTM=bradfitz
    R=golang-codereviews, josharian, bradfitz
    CC=golang-codereviews
    https://golang.org/cl/70380043
    a18bfb8c
smtp.go 9.2 KB