From 50c83b08f05523db2d6a8b52784d83d093f30768 Mon Sep 17 00:00:00 2001 From: arzumify Date: Sun, 15 Dec 2024 11:49:32 +0000 Subject: [PATCH] Fix the broken SMTP sending --- smtp.go | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/smtp.go b/smtp.go index 9a889e2..bd3dfe3 100644 --- a/smtp.go +++ b/smtp.go @@ -621,29 +621,9 @@ type SenderArgs struct { EnforceTLS bool } -type DebugRWC struct { - net.Conn -} - -func (d DebugRWC) Write(p []byte) (n int, err error) { - fmt.Println("Write: ", string(p)) - return d.Conn.Write(p) -} - -func (d DebugRWC) Read(p []byte) (n int, err error) { - n, err = d.Conn.Read(p) - fmt.Println("Read: ", string(p)) - return -} - -func (d DebugRWC) Close() error { - fmt.Println("Close") - return d.Conn.Close() -} - // Send sends an email to another server func Send(args SenderArgs, mail *Mail, conn net.Conn, mxHost string) (err error) { - textConn := textproto.NewConn(DebugRWC{conn}) + textConn := textproto.NewConn(conn) err = textConn.PrintfLine("RSET") if err != nil { @@ -702,11 +682,6 @@ func Send(args SenderArgs, mail *Mail, conn net.Conn, mxHost string) (err error) InsecureSkipVerify: false, }) - err = tlsConn.Handshake() - if err != nil { - return err - } - textConn = textproto.NewConn(tlsConn) // Just use HELO, no point using EHLO when we already have all the capabilities