File: .mailfilter

package info (click to toggle)
otrs 1.3.2p01-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 15,572 kB
  • ctags: 3,355
  • sloc: perl: 65,615; sql: 4,703; sh: 1,149; xml: 727; makefile: 23; php: 16
file content (79 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# --
# .mailfilter - mailfilter of the OTRS user
# Copyright (C) 2003 Wiktor Wodecki <wiktor.wodecki@net-m.de>
# --
# $Id: .mailfilter,v 1.2 2003/01/18 12:21:23 martin Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see 
# the enclosed file COPYING for license information (GPL). If you 
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --

#SYS_HOME=/opt/otrs
SYS_HOME=$HOME

import DEFAULT
LOCALDEFAULT=$DEFAULT
DEFAULT=${SYS_HOME}/var/spool/`date +%s`${FROM}${SIZE}
MONTHFOLDER=`date +%Y-%m`
YEARFOLDER=`date +%Y`

# --
# Remove all X-OTRS Header (allow this only for trusted email)
# e. g. from *@example.com
# --
if (/^To:.*@example.com/)
{
	xfilter "grep -vi '^X-OTRS-'"
}

# or just not emails with "X-OTRS-Ident: ahfiw2Fw32r230dddl2foeo3r" header!
#if (/^X-OTRS-Ident: ahfiw2Fw32r230dddl2foeo3r/)
#{
#	xfilter "grep -vi '^X-OTRS-'"
#}


# --
# Examples for queue presorting.
# --
if (/^To:.*@example.com/)
{
	xfilter "formail -I \"X-OTRS-Queue: example\""
}

if (/^List-Id:.*OpenAntiVirus/)
{
	xfilter "formail -I \"X-OTRS-Queue: OpenAntiVirus\""
}

# --
# Example for add free form key and value (max 3). 
# --
if (/^To:.*@example.com/)
{
	xfilter "formail -I \"X-OTRS-ArticleKey1: Test\""
	xfilter "formail -I \"X-OTRS-ArticleValue1: True!\""
}

# --
# Backup of all incoming emails. 
# It's always better to have a backup of all incoming emails!
# --
cc ${SYS_HOME}/var/INBOX.Backup.${MONTHFOLDER}

# --
# Pipe all email into the PostMaster process.
# --
xfilter "${SYS_HOME}/bin/PostMaster.pl"

# --
# spool all the rest (which the PostMaster.pl can't process!) 
# If the database is down or the PostMaster.pl exit was not '0'!
# --
to $DEFAULT

# --
# end of .mailfilter
# --