go-smtp icon indicating copy to clipboard operation
go-smtp copied to clipboard

Feature Request: Support for XCLIENT Command in go-smtp

Open zzh-coders opened this issue 1 year ago • 0 comments
trafficstars

Background I am currently using the Extension method to check if the server supports the XCLIENT extension. However, I would like to know how to issue the XCLIENT command using the go-smtp library.

Request Please provide support for issuing the XCLIENT command in the go-smtp library. Specifically, it would be helpful to have a clear example or built-in method to facilitate this functionality.

Current Situation Here is the code snippet I am using to check for the XCLIENT extension:

`client, err := smtp.Dial("smtp.example.com:25") if err != nil { log.Fatal(err) } defer client.Close()

ok, ext := client.Extension("XCLIENT") if ok { fmt.Println("XCLIENT extension is supported:", ext) } else { fmt.Println("XCLIENT extension is not supported") }`

Desired Functionality I need to issue the XCLIENT command after confirming that the server supports it. Ideally, the solution should handle the following:

Issuing the XCLIENT command. Specifying parameters such as ADDR, NAME, PORT, etc. Handling any responses or errors from the server. Example Implementation A conceptual example of what I am looking for:

if ok { err := client.XClient("ADDR=192.168.1.1 NAME=myclient") if err != nil { log.Fatal("Error issuing XCLIENT command:", err) } }

Conclusion Enhancing the go-smtp library to support the XCLIENT command would be highly beneficial for users needing to interact with servers that require this extension. Thank you for considering this feature request.

zzh-coders avatar Jul 15 '24 09:07 zzh-coders