@@ -92,14 +92,12 @@ func (a *Address) IsPostmaster() bool {
}
return false
-var ap = mail.AddressParser{}
-var apLock sync.Mutex // guards mail.AddressParser
// NewAddress takes a string of an RFC 5322 address of the
// form "Gogh Fir <[email protected]>" or "[email protected]".
func NewAddress(str string) (*Address, error) {
- apLock.Lock()
- defer apLock.Unlock()
+
+ var ap smtp.RFC5322
l, err := ap.Address([]byte(str))
if err != nil {
return nil, err
@@ -1,4 +1,4 @@
-package rfc5321
+package smtp
import (
"errors"
"testing"
@@ -21,6 +21,7 @@ const (
// The minimum total number of recipients that must be buffered is 100
LimitRecipients = 100
)
type PathParam []string
type TransportType int
@@ -51,13 +52,12 @@ func (p PathParam) Transport() TransportType {
var atExpected = errors.New("@ expected as part of mailbox")
-
// Parse Email Addresses according to https://tools.ietf.org/html/rfc5321
type Parser struct {
- NullPath bool
- LocalPart string
- LocalPartQuotes bool // does the local part need quotes?
- Domain string
+ NullPath bool
+ LocalPart string
+ LocalPartQuotes bool // does the local part need quotes?
+ Domain string
IP net.IP
ADL []string
@@ -647,7 +647,6 @@ func TestHelo(t *testing.T) {
func TestTransport(t *testing.T) {
path := PathParam([]string{"BODY", "8bitmime"})
@@ -673,4 +672,4 @@ func TestTransport(t *testing.T) {
if transport != TransportTypeUnspecified {
t.Error("transport was not unspecified")
-}
+}
@@ -521,7 +521,7 @@ func sendMessage(greet string, TLS bool, w *textproto.Writer, t *testing.T, line
line, _ = r.ReadLine()
- if err := w.PrintfLine("Subject: Test subject\r\n\r\nHello Sir,\nThis is a test.\r\n."); err != nil {
+ if err := w.PrintfLine("Subject: Test subject\r\n\r\nHello Sir,\nThis is a test.\r\n.\r"); err != nil {
t.Error(err)