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

EHLO after RSET

Open sapmli opened this issue 1 year ago • 0 comments

Currently, go-smtp starts a new session for every EHLO command it receives. So, any user information, e.g. from AUTH LOGIN, gets lost.

RFC 5321 states:

An EHLO command MAY be issued by a client later in the session. If it is issued after the session begins and the EHLO command is acceptable to the SMTP server, the SMTP server MUST clear all buffers and reset the state exactly as if a RSET command had been issued. In other words, the sequence of RSET followed immediately by EHLO is redundant, but not harmful other than in the performance cost of executing unnecessary commands.

Probably this means the new EHLO argument should be handed over to an existing session, instead of starting a new session. Clients may issue an EHLO after RSET, to set a different client information for the next mail in the same connection.

It's currently also not possible to send a new EHLO after RSET in outgoing connections using the SMTP client.

sapmli avatar Aug 29 '24 08:08 sapmli