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 }
// 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 }