View definition


Defined in


FormatAddress formats an address and a name as a valid RFC 5322 address.


// SetAddressHeader sets an address to the given header field.
func (m *Message) SetAddressHeader(field, address, name string) {
	m.header[field] = []string{m.FormatAddress(address, name)}

	m := NewMessage()
	m.SetAddressHeader("From", "[email protected]", "Señor From")
	m.SetHeader("To", m.FormatAddress("[email protected]", "Señor To"), "[email protected]")
	m.SetAddressHeader("Cc", "[email protected]", "A, B")
	m.SetAddressHeader("X-To", "[email protected]", "à, b")

FormatAddress is referenced in 2 repositories