mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-14 18:02:55 +01:00
Update EnvelopeFromFormat documentation in msg.go
Expanded the documentation for the EnvelopeFromFormat method to clarify its purpose, usage, and compliance with RFC 5322. Added details on how the envelope from address is used in SMTP communication and validation requirements.
This commit is contained in:
parent
1dcdad9da1
commit
3d5435c138
1 changed files with 8 additions and 2 deletions
10
msg.go
10
msg.go
|
@ -398,8 +398,14 @@ func (m *Msg) EnvelopeFrom(from string) error {
|
|||
return m.SetAddrHeader(HeaderEnvelopeFrom, from)
|
||||
}
|
||||
|
||||
// EnvelopeFromFormat takes a name and address, formats them RFC5322 compliant and stores them as
|
||||
// the envelope FROM address header field
|
||||
// EnvelopeFromFormat sets the provided name and mail address as HeaderEnvelopeFrom for the Msg.
|
||||
//
|
||||
// The HeaderEnvelopeFrom address is generally not included in the mail body but only used by the Client for the
|
||||
// communication with the SMTP server. If the Msg has no "FROM" address set in the mail body, the msgWriter will
|
||||
// try to use the envelope from address, if this has been set for the Msg. The provided name and address adre
|
||||
// validated according to RFC 5322 and will return an error if the validation fails.
|
||||
//
|
||||
// https://datatracker.ietf.org/doc/html/rfc5322#section-3.4
|
||||
func (m *Msg) EnvelopeFromFormat(name, addr string) error {
|
||||
return m.SetAddrHeader(HeaderEnvelopeFrom, fmt.Sprintf(`"%s" <%s>`, name, addr))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue