Fix the broken SMTP sending

This commit is contained in:
Tracker-Friendly 2024-12-15 11:49:32 +00:00
parent 1a1cc2a683
commit 50c83b08f0
1 changed files with 1 additions and 26 deletions

27
smtp.go
View File

@ -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