forked from emersion/go-milter
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from d--j/header
Header Unfolding & SetAddressList formatting
- Loading branch information
Showing
7 changed files
with
196 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM <[email protected]> | ||
HEADER | ||
From: <> | ||
To: <[email protected]> | ||
Subject: test | ||
Date: Fri, 10 Mar 2023 23:29:35 +0000 (UTC) | ||
Message-ID: <[email protected]> | ||
. | ||
DECISION ACCEPT | ||
HEADER | ||
Received: placeholder | ||
From: <> | ||
To: <[email protected]>, | ||
<[email protected]> | ||
Subject: test | ||
Date: Fri, 10 Mar 2023 23:29:35 +0000 (UTC) | ||
Message-ID: <[email protected]> | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
|
||
"github.com/d--j/go-milter/integration" | ||
"github.com/d--j/go-milter/mailfilter" | ||
"github.com/emersion/go-message/mail" | ||
) | ||
|
||
func main() { | ||
|
@@ -57,6 +58,13 @@ func main() { | |
} | ||
trx.Headers().Add("X-ADD1", "Test") | ||
trx.Headers().Add("X-ADD2", "Test") | ||
case "[email protected]": | ||
addr, err := trx.Headers().AddressList("To") | ||
if err != nil { | ||
return nil, err | ||
} | ||
addr = append(addr, &mail.Address{Address: "[email protected]"}) | ||
trx.Headers().SetAddressList("To", addr) | ||
default: | ||
return mailfilter.CustomErrorResponse(500, "unknown mail from"), nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.