File: pm-jasrv-from.rc

package info (click to toggle)
procmail-lib 1%3A2009.1202-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,372 kB
  • ctags: 541
  • sloc: perl: 294; makefile: 196; sh: 4
file content (103 lines) | stat: -rw-r--r-- 3,476 bytes parent folder | download | duplicates (5)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# pm-jasrv-from.rc -- compose reply, subroutine for File Server
#
#   File id
#
#       Copyright (C) 1997-2010 Jari Aalto
#
#       This program is free software; you can redistribute it and/or
#       modify it under the terms of the GNU General Public License as
#       published by the Free Software Foundation; either version 2 of the
#       License, or (at your option) any later version
#
#       This program is distributed in the hope that it will be useful, but
#       WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#       General Public License for more details at
#       <http://www.gnu.org/copyleft/gpl.html>.
#
#   Description
#
#       This subroutine is part of the MPFS file server.
#       Compose headers for reply message using `formail' -rt.
#
#       Here is dry run example to test this module
#
#	    % procmail DEFAULT=/dev/null VERBOSE=on LOGABSTRACT=all         \
#		FORMAIL=/opt/local/bin/formail                              \
#		JA_SRV_FORMAIL_FROM=me@here                                 \
#		JA_SRV_CONTENT_TYPE=content-type                            \
#		JA_SRV_XLOOP=xloop                                          \
#		$HOME/pm/pm-jasrv-from.rc				    \
#	        < $HOME/any-sample.email
#
#   Input
#
#       o   JA_SRV_FORMAIL_FROM, JA_SRV_XLOOP
#       o   JA_SRV_CONTENT_TYPE
#
#   Output
#
#       (none)
#
#   Change Log (none)

# ............................................................ &init ...

id    = "pm-jasrv-from.rc"
dummy = "
========================================================================
$id: init:
"


#   add initial headers. The MIME headers may
#   very well change later on

dummy = "$id: Preparing reply."

#   This a bit special. When we construct reply to user with formail
#   -rt, the From address would include the address where your
#   server is. That't usually fine.
#
#   But if you have some virtual or `contact' address that you want
#   poeple to use instead of the current address where are, then you
#   want to rewrite the `From' field. Hm. You could also add Reply-To,
#   but suppose you don't want to show the real address at all.
#
#   If you set JA_SRV_FORMAIL_FROM variable, then the email address
#   appears in From field. If you don't define the variable, a normal
#   formail -rt is used.
#
#   Adding "From:" automatically adds From_, get rid of it too
#
#	NOTE: We must put something into `header'; because the above formail
#	fails if the header contains only "". In here we duplicate the
#	harmless call to "-aMessage-ID:"

header  = "-aMessage-ID:"

:0
* JA_SRV_FORMAIL_FROM ?? [a-z]
{
    header =  "-AFrom: $JA_SRV_FORMAIL_FROM"
}


:0 fhw
| $FORMAIL -rt                                                              \
    -a  Message-ID:                                                         \
    -A "Mime-Version: 1.0"                                                  \
    -A "Content-Type: $JA_SRV_CONTENT_TYPE"                                 \
    -A "Content-Transfer-Encoding: 7bit"                                    \
    -A "Precedence: bulk"                                                   \
    -A "X-Loop: $JA_SRV_XLOOP"                                              \
    -I "From "                                                              \
    ${header+"$header"}


#    test = `$CAT - >> $HOME/tmp/srv.tst`


dummy = "$id: end:"

# Enf of pm-jasrv-from.rc