1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

policy: Implement store domain policy for #51

- Update docs, change log, status.html
This commit is contained in:
James Hillyerd
2018-04-01 19:46:44 -07:00
parent a7d2b00a9c
commit 064549f576
9 changed files with 91 additions and 53 deletions

View File

@@ -50,10 +50,14 @@ func (a *Addressing) ShouldAcceptDomain(domain string) bool {
return false
}
// ShouldStoreDomain indicates if Inbucket stores email destined for the specified domain.
// ShouldStoreDomain indicates if Inbucket stores mail destined for the specified domain.
func (a *Addressing) ShouldStoreDomain(domain string) bool {
if a.Config.StoreMessages {
return strings.ToLower(domain) != strings.ToLower(a.Config.DomainNoStore)
domain = strings.ToLower(domain)
if a.Config.DefaultStore && !stringutil.SliceContains(a.Config.DiscardDomains, domain) {
return true
}
if !a.Config.DefaultStore && stringutil.SliceContains(a.Config.StoreDomains, domain) {
return true
}
return false
}