MCPcopy Create free account
hub / github.com/foxcpp/maddy / precisEmail

Function precisEmail

framework/address/norm.go:145–169  ·  view source on GitHub ↗
(addr string, profile *precis.Profile)

Source from the content-addressed store, hash-verified

143}
144
145func precisEmail(addr string, profile *precis.Profile) (string, error) {
146 mbox, domain, err := Split(addr)
147 if err != nil {
148 return "", fmt.Errorf("address: precis: %w", err)
149 }
150
151 // PRECISFold is not included in the regular address.ForLookup since it reduces
152 // the range of valid addresses to a subset of actually valid values.
153 // PRECISFold is a matter of our own local policy, not a general rule for all
154 // email addresses.
155
156 // Side note: For used profiles, there is no practical difference between
157 // CompareKey and String.
158 mbox, err = profile.CompareKey(mbox)
159 if err != nil {
160 return "", fmt.Errorf("address: precis: %w", err)
161 }
162
163 domain, err = dns.ForLookup(domain)
164 if err != nil {
165 return "", fmt.Errorf("address: precis: %w", err)
166 }
167
168 return mbox + "@" + domain, nil
169}

Callers 2

PRECISFoldFunction · 0.85
PRECISFunction · 0.85

Calls 2

ForLookupFunction · 0.92
SplitFunction · 0.85

Tested by

no test coverage detected