diff --git a/CHANGELOG.md b/CHANGELOG.md index 419c012..9a61a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Fixed +- Support for `AUTH=<>` FROM parameter (#284) + + ## [v3.0.2] - 2022-07-04 Note: We had to abandon the 3.0.1 release, see the blog post [What happened to diff --git a/pkg/server/smtp/handler.go b/pkg/server/smtp/handler.go index 3162b62..f9e9a55 100644 --- a/pkg/server/smtp/handler.go +++ b/pkg/server/smtp/handler.go @@ -54,11 +54,11 @@ const ( QUIT ) -// fromRegex captures the from address and optional BODY=8BITMIME clause. Matches FROM, while -// accepting '>' as quoted pair and in double quoted strings (?i) makes the regex case insensitive, -// (?:) is non-grouping sub-match +// fromRegex captures the from address and optional parameters. Matches FROM, while accepting '>' +// as quoted pair and in double quoted strings (?i) makes the regex case insensitive, (?:) is +// non-grouping sub-match. Accepts empty angle bracket value in options for 'AUTH=<>'. var fromRegex = regexp.MustCompile( - "(?i)^FROM:\\s*<((?:(?:\\\\>|[^>])+|\"[^\"]+\"@[^>])+)?>( [\\w= ]+)?$") + `(?i)^FROM:\s*<((?:(?:\\>|[^>])+|"[^"]+"@[^>])+)?>( [\w= ]+(?:=<>)?)?$`) func (s State) String() string { switch s { diff --git a/pkg/server/smtp/handler_test.go b/pkg/server/smtp/handler_test.go index 4e505df..582dc42 100644 --- a/pkg/server/smtp/handler_test.go +++ b/pkg/server/smtp/handler_test.go @@ -193,6 +193,10 @@ func TestReadyState(t *testing.T) { {"RSET", 250}, {"MAIL FROM: SIZE=1024", 250}, {"RSET", 250}, + {"MAIL FROM: SIZE=1024 BODY=8BITMIME", 250}, + {"RSET", 250}, + {"MAIL FROM: SIZE=4096 AUTH=<>", 250}, + {"RSET", 250}, {"MAIL FROM:", 250}, {"RSET", 250}, {"MAIL FROM:<\"first last\"@space.com>", 250},