Skip to content

Commit

Permalink
fix #15: correctly parse esmtp args on MAIL and RCPT
Browse files Browse the repository at this point in the history
  • Loading branch information
hxdmp committed Oct 5, 2023
1 parent 30d4d62 commit 6b84246
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ func (m *serverSession) Process(msg *wire.Message) (*Response, error) {
m.macros.DelStageAndAbove(StageRcpt)
from := wire.ReadCString(msg.Data)
msg.Data = msg.Data[len(from)+1:]
esmtpArgs := wire.ReadCString(msg.Data)

// the rest of the data are ESMTP arguments, separated by a zero byte.
esmtpArgs := strings.Join(wire.DecodeCStrings(msg.Data), " ")

return m.backend.MailFrom(RemoveAngle(from), esmtpArgs, newModifier(m, true))

case wire.CodeRcpt:
Expand All @@ -221,7 +224,10 @@ func (m *serverSession) Process(msg *wire.Message) (*Response, error) {
m.macros.DelStageAndAbove(StageData)
to := wire.ReadCString(msg.Data)
msg.Data = msg.Data[len(to)+1:]
esmtpArgs := wire.ReadCString(msg.Data)

// the rest of the data are ESMTP arguments, separated by a zero byte.
esmtpArgs := strings.Join(wire.DecodeCStrings(msg.Data), " ")

return m.backend.RcptTo(RemoveAngle(to), esmtpArgs, newModifier(m, true))

case wire.CodeData:
Expand Down

0 comments on commit 6b84246

Please sign in to comment.