mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-03 05:07:38 +03:00
add subject
This commit is contained in:
parent
e33c8d6f91
commit
7a06fa2012
2 changed files with 6 additions and 4 deletions
|
@ -96,8 +96,8 @@ command executable_name args... { }
|
|||
|
||||
Same as check.command, following placeholders are supported for command
|
||||
arguments: {source_ip}, {source_host}, {source_rdns}, {msg_id}, {auth_user},
|
||||
{sender}, {rcpt_to}, {original_rcpt_to}, {address}. Note: placeholders in command
|
||||
name are not processed to avoid possible command injection attacks.
|
||||
{sender}, {rcpt_to}, {original_rcpt_to}, {address}, {subject}. Note: placeholders
|
||||
in command name are not processed to avoid possible command injection attacks.
|
||||
|
||||
Additionally, for imap.filter.command, {account_name} placeholder is replaced
|
||||
with effective IMAP account name.
|
||||
|
|
|
@ -49,7 +49,7 @@ type Check struct {
|
|||
}
|
||||
|
||||
func (c *Check) IMAPFilter(accountName string, rcptTo string, msgMeta *module.MsgMetadata, hdr textproto.Header, body buffer.Buffer) (folder string, flags []string, err error) {
|
||||
cmd, args := c.expandCommand(msgMeta, accountName, rcptTo)
|
||||
cmd, args := c.expandCommand(msgMeta, accountName, rcptTo, hdr)
|
||||
|
||||
var buf bytes.Buffer
|
||||
_ = textproto.WriteHeader(&buf, hdr)
|
||||
|
@ -95,7 +95,7 @@ func (c *Check) Init(cfg *config.Map) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (c *Check) expandCommand(msgMeta *module.MsgMetadata, accountName string, rcptTo string) (string, []string) {
|
||||
func (c *Check) expandCommand(msgMeta *module.MsgMetadata, accountName string, rcptTo string, hdr textproto.Header) (string, []string) {
|
||||
expArgs := make([]string, len(c.cmdArgs))
|
||||
|
||||
for i, arg := range c.cmdArgs {
|
||||
|
@ -144,6 +144,8 @@ func (c *Check) expandCommand(msgMeta *module.MsgMetadata, accountName string, r
|
|||
oldestOriginalRcpt = originalRcpt
|
||||
}
|
||||
return oldestOriginalRcpt
|
||||
case "{subject}":
|
||||
return hdr.Get("Subject")
|
||||
case "{account_name}":
|
||||
return accountName
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue