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

add reject from origin domain feature (#375)

Add a new feature to be able to reject email *from* specific domains.

Co-authored-by: Cyril DUPONT <cyd@9bis.com>
This commit is contained in:
Cyd
2023-08-26 20:05:20 +02:00
committed by GitHub
parent 7c13a98ad2
commit 06ec140e72
9 changed files with 127 additions and 38 deletions

View File

@@ -19,7 +19,7 @@ import (
type Manager interface {
Deliver(
to *policy.Recipient,
from string,
from *policy.Origin,
recipients []*policy.Recipient,
prefix string,
content []byte,
@@ -43,7 +43,7 @@ type StoreManager struct {
// Deliver submits a new message to the store.
func (s *StoreManager) Deliver(
to *policy.Recipient,
from string,
from *policy.Origin,
recipients []*policy.Recipient,
prefix string,
source []byte,
@@ -56,7 +56,8 @@ func (s *StoreManager) Deliver(
}
fromaddr, err := env.AddressList("From")
if err != nil || len(fromaddr) == 0 {
fromaddr = []*mail.Address{{Address: from}}
fromaddr = make([]*mail.Address, 1)
fromaddr[0] = &from.Address
}
toaddr, err := env.AddressList("To")
if err != nil {