use shorter smtp.NewAddress() instead of smtp.Address{...}

This commit is contained in:
Mechiel Lukkien
2024-05-09 21:26:22 +02:00
parent 1179d9d80a
commit ebb8ad06b5
9 changed files with 10 additions and 10 deletions

View File

@ -107,7 +107,7 @@ func ExampleComposer() {
}()
// Add an address header.
xc.HeaderAddrs("From", []message.NameAddress{{DisplayName: "Charlie", Address: smtp.Address{Localpart: "root", Domain: dns.Domain{ASCII: "localhost"}}}})
xc.HeaderAddrs("From", []message.NameAddress{{DisplayName: "Charlie", Address: smtp.NewAddress("root", dns.Domain{ASCII: "localhost"})}})
// Add subject header, with encoding
xc.Subject("hi ☺")

View File

@ -51,6 +51,6 @@ func From(elog *slog.Logger, strict bool, r io.ReaderAt, p *Part) (raddr smtp.Ad
if err != nil {
return raddr, nil, nil, fmt.Errorf("parsing localpart in from address: %v", err)
}
addr := smtp.Address{Localpart: lp, Domain: d}
addr := smtp.NewAddress(lp, d)
return addr, p.Envelope, textproto.MIMEHeader(header), nil
}