From b962187e779f1335789cc1175962b4c502e72a03 Mon Sep 17 00:00:00 2001 From: patelsmuseum Date: Fri, 14 Nov 2025 12:56:40 +0530 Subject: [PATCH] postmaster --- mail/rfc5321/parse.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mail/rfc5321/parse.go b/mail/rfc5321/parse.go index 1d22b8a..27bccd5 100644 --- a/mail/rfc5321/parse.go +++ b/mail/rfc5321/parse.go @@ -7,7 +7,6 @@ import ( "errors" "net" "strconv" - "strings" ) const ( @@ -104,14 +103,14 @@ func (s *Parser) forwardPath() (err error) { return err } // special case for forwardPath only - can just be addressed to postmaster - if i := strings.Index(strings.ToLower(s.LocalPart), postmasterLocalPart); i == 0 { - s.LocalPart = postmasterLocalPart - return nil // atExpected will be ignored, postmaster doesn't need @ - } + //if i := strings.Index(strings.ToLower(s.LocalPart), postmasterLocalPart); i == 0 { + // s.LocalPart = postmasterLocalPart + // return nil // atExpected will be ignored, postmaster doesn't need @ + //} return err // it may return atExpected } -//MailFrom accepts the following syntax: Reverse-path [SP Mail-parameters] CRLF +// MailFrom accepts the following syntax: Reverse-path [SP Mail-parameters] CRLF func (s *Parser) MailFrom(input []byte) (err error) { s.set(input) if err := s.reversePath(); err != nil { @@ -133,8 +132,9 @@ func (s *Parser) MailFrom(input []byte) (err error) { const postmasterLocalPart = "postmaster" -//RcptTo accepts the following syntax: ( "" / "" / -// Forward-path ) [SP Rcpt-parameters] CRLF +// RcptTo accepts the following syntax: ( "" / "" / +// +// Forward-path ) [SP Rcpt-parameters] CRLF func (s *Parser) RcptTo(input []byte) (err error) { s.set(input) if err := s.forwardPath(); err != nil { @@ -354,8 +354,9 @@ func (s *Parser) mailbox() error { } // "[" ( IPv4-address-literal / -// IPv6-address-literal / -// General-address-literal ) "]" +// +// IPv6-address-literal / +// General-address-literal ) "]" func (s *Parser) addressLiteral() error { ch := s.next() if ch == '[' { @@ -435,7 +436,7 @@ func (s *Parser) snum() error { return errors.New("too many digits") } -//IPv6:" IPv6-addr +// IPv6:" IPv6-addr func (s *Parser) ipv6AddressLiteral() error { var ip bytes.Buffer for c := s.next(); ; c = s.next() { @@ -528,7 +529,7 @@ func (s *Parser) QcontentSMTP() error { } } -//Dot-string = Atom *("." Atom) +// Dot-string = Atom *("." Atom) func (s *Parser) dotString() error { for { if err := s.atom(); err != nil { @@ -613,7 +614,7 @@ func isLetDig(c byte) bool { return false } -//ehlo = "EHLO" SP ( Domain / address-literal ) CRLF +// ehlo = "EHLO" SP ( Domain / address-literal ) CRLF // Note: "HELO" is ignored here func (s *Parser) Ehlo(input []byte) (domain string, ip net.IP, err error) { s.set(input)