Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewPlainDialer(host string, port int, username, password string) *Dialer {
// Dial dials and authenticates to an SMTP server. The returned SendCloser
// should be closed when done using it.
func (d *Dialer) Dial() (SendCloser, error) {
conn, err := netDialTimeout("tcp", addr(d.Host, d.Port), 10*time.Second)
conn, err := NetDialTimeout("tcp", addr(d.Host, d.Port), 10*time.Second)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func (c *smtpSender) Close() error {

// Stubbed out for tests.
var (
netDialTimeout = net.DialTimeout
NetDialTimeout = net.DialTimeout
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be moved out of this var block so no one's confused later by the // Stubbed out for tests. comment.

tlsClient = tls.Client
smtpNewClient = func(conn net.Conn, host string) (smtpClient, error) {
return smtp.NewClient(conn, host)
Expand Down
2 changes: 1 addition & 1 deletion smtp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func doTestSendMail(t *testing.T, d *Dialer, want []string, timeout bool) {
timeout: timeout,
}

netDialTimeout = func(network, address string, d time.Duration) (net.Conn, error) {
NetDialTimeout = func(network, address string, d time.Duration) (net.Conn, error) {
if network != "tcp" {
t.Errorf("Invalid network, got %q, want tcp", network)
}
Expand Down