Esempio n. 1
0
func (m *Message) AddRecipient(rcpt smtpd.MailAddress) error {
	m.To = strings.ToLower(rcpt.Email())
	if !strings.HasSuffix(m.To, "@"+*domain) {
		return errors.New("Invalid recipient domain")
	}
	return nil
}
Esempio n. 2
0
// Add recipient method for Message types
// Required by package
func (m *Message) AddRecipient(to smtpd.MailAddress) error {
	m.To = strings.ToLower(to.Email())

	// Check if valid domain to receive mail for
	if OptDomainCheckingOn {
		_, dom := SplitToAddress(m.To)
		err := DomainCheck(OptValidDomains, dom)
		if err != nil {
			return fmt.Errorf("%v", err)
		}
	}

	return nil
}