Załącznik 'dmarc.xslt'
Download 1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <xsl:stylesheet version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:date="http://exslt.org/dates-and-times"
6 xmlns="http://www.w3.org/1999/xhtml">
7 <xsl:output
8 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
9 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
10 <xsl:param name="source_ip_href">
11 <!-- customize this -->
12 <xsl:text>http://whatismyipaddress.com/ip/</xsl:text>
13 <!-- alternative examples:
14 <xsl:text>http://network-tools.com/default.asp?prog=lookup&host=</xsl:text>
15 <xsl:text>http://www.ip-adress.com/reverse_ip/</xsl:text>
16 -->
17 </xsl:param>
18 <xsl:template match="feedback">
19 <html xmlns="http://www.w3.org/1999/xhtml">
20 <xsl:variable name="title">
21 Feedback from
22 <xsl:value-of select="report_metadata/org_name"/>
23 </xsl:variable>
24 <head>
25 <title>
26 <xsl:value-of select="$title"/>
27 </title>
28 <style type="text/css" id="internal-style">
29 body {
30 font-family: Arial, Helvetica, sans-serif;
31 color: #003300;
32 background-color: #ffcc66;
33 }
34 table, p {
35 margin: 1em;
36 padding: 4pt;
37 background-color: #ffeeaa;
38 border: 3pt solid #776633;
39 }
40 td, th {
41 margin: 2pt;
42 padding: 2pt;
43 border: 1pt solid #776633;
44 }
45 .pass {
46 background-color: #11bb00;
47 }
48 .fail {
49 background-color: #cc0000;
50 }
51 .dkimpolicy {
52 background-color: #ffff66;
53 }
54 .error {
55 background-color: #bbaaaa;
56 font-weight: bold;
57 }
58 .softfail {
59 background-color: #ff8866;
60 }
61 .reject {
62 background-color: #cc0000;
63 }
64 .quarantine {
65 background-color: #ff8866;
66 }
67 .normal {
68 }
69 .field {
70 font-weight: bold;
71 }
72 </style>
73 </head>
74 <body>
75 <h1>
76 <xsl:value-of select="$title"/>
77 </h1>
78 <p>
79 <xsl:apply-templates select="report_metadata"/>
80 <br/>
81 <xsl:apply-templates select="policy_published"/>
82 </p>
83 <table>
84 <tr>
85 <th>
86 Relaying IP
87 </th>
88 <th>
89 message count
90 </th>
91 <th>
92 reason and disposition
93 </th>
94 <th>
95 From header
96 <br/>
97 (opt. envelope)
98 </th>
99 <th>
100 SPF
101 </th>
102 <xsl:variable name="signatures">
103 <xsl:for-each select="record/auth_results">
104 <xsl:sort select="count(dkim)"
105 data-type="number" order="descending"/>
106 <xsl:if test="position()=1">
107 <xsl:value-of select="count(dkim)"/>
108 </xsl:if>
109 </xsl:for-each>
110 </xsl:variable>
111 <xsl:if test="$signatures > 0">
112 <th>
113 DKIM
114 </th>
115 <xsl:if test="$signatures > 1">
116 <th>
117 2nd DKIM
118 </th>
119 <xsl:if test="$signatures > 2">
120 <th>
121 3rd DKIM
122 </th>
123 </xsl:if>
124 </xsl:if>
125 </xsl:if>
126 </tr>
127 <xsl:text>
128 </xsl:text>
129 <xsl:apply-templates select="record"/>
130 </table>
131 <p>
132 <b><u>Legend</u><br/>
133 disposition: </b>
134 <span class="quarantine">quarantine</span>,
135 <span class="reject">reject</span>.<br/>
136 <b>spf: </b>
137 <span class="pass">pass</span>,
138 <span class="fail">fail</span>,
139 <span class="softfail">softfail</span>,
140 <span class="error">temperror or permerror</span>.<br/>
141 <b>dkim: </b>
142 <span class="pass">pass</span>,
143 <span class="fail">fail</span>,
144 <span class="dkimpolicy">policy</span>.
145 </p>
146 </body>
147 </html>
148 </xsl:template>
149 <xsl:template match="policy_published">
150 <span class="field">Domain: </span>
151 <xsl:value-of select="domain"/>
152 <xsl:text>; </xsl:text>
153 <span class="field">DKIM: </span>
154 <xsl:apply-templates select="adkim"/>
155 <xsl:text>; </xsl:text>
156 <span class="field">SPF: </span>
157 <xsl:apply-templates select="aspf"/>
158 <xsl:text>; </xsl:text>
159 <span class="field">policy published: </span>
160 <xsl:value-of select="p"/>
161 <xsl:text> </xsl:text>
162 <xsl:value-of select="sp"/>
163 <xsl:text> </xsl:text>
164 <xsl:value-of select="pct"/>
165 </xsl:template>
166 <xsl:template match="adkim|aspf">
167 <xsl:variable name="alignment">
168 <xsl:value-of select="."/>
169 </xsl:variable>
170 <xsl:choose>
171 <xsl:when test="$alignment='r'">
172 <xsl:text>relaxed</xsl:text>
173 </xsl:when>
174 <xsl:when test="$alignment='s'">
175 <xsl:text>strict</xsl:text>
176 </xsl:when>
177 <xsl:otherwise>
178 <xsl:text>{$alignment}</xsl:text>
179 </xsl:otherwise>
180 </xsl:choose>
181 </xsl:template>
182 <xsl:template match="report_metadata">
183 <span class="field">Id: </span>
184 <xsl:value-of select="report_id"/>
185 <xsl:text>; </xsl:text>
186 <span class="field">begin: </span>
187 <xsl:call-template name="date-range">
188 <xsl:with-param name="utime" select="date_range/begin"/>
189 </xsl:call-template>
190 <xsl:text>; </xsl:text>
191 <span class="field">end: </span>
192 <xsl:call-template name="date-range">
193 <xsl:with-param name="utime" select="date_range/end"/>
194 </xsl:call-template>
195 <xsl:for-each select="error">
196 <xsl:if test="position()=1">
197 <br/>
198 <span class="field">Error: </span>
199 </xsl:if>
200 <span class="error">
201 <xsl:value-of select="."/>
202 </span>
203 <xsl:if test="not(position()=last())">
204 <br/>
205 </xsl:if>
206 </xsl:for-each>
207 </xsl:template>
208 <xsl:template name="date-range">
209 <xsl:param name="utime" select="0"/>
210 <xsl:choose>
211 <xsl:when test="function-available('date:add')">
212 <xsl:value-of
213 select="date:add('1970-01-01T00:00:00', date:duration($utime))"/>
214 </xsl:when>
215 <xsl:otherwise>
216 <xsl:value-of select="$utime"/>
217 </xsl:otherwise>
218 </xsl:choose>
219 </xsl:template>
220 <xsl:template match="record">
221 <tr>
222 <xsl:apply-templates select="row"/>
223 <xsl:apply-templates select="identifiers|identities"/>
224 <xsl:apply-templates select="auth_results"/>
225 </tr>
226 <xsl:text>
227 </xsl:text>
228 </xsl:template>
229 <xsl:template match="row">
230 <td>
231 <a>
232 <xsl:attribute name="href">
233 <xsl:value-of select="$source_ip_href"/>
234 <xsl:value-of select="source_ip"/>
235 </xsl:attribute>
236 <xsl:value-of select="source_ip"/>
237 </a>
238 </td>
239 <td align="right">
240 <xsl:value-of select="count"/>
241 </td>
242 <td>
243 <xsl:attribute name="class">
244 <xsl:variable name="disposition">
245 <xsl:value-of select="policy_evaluated/disposition"/>
246 </xsl:variable>
247 <xsl:choose>
248 <xsl:when test="$disposition='reject'">
249 <xsl:text>reject</xsl:text>
250 </xsl:when>
251 <xsl:when test="$disposition='quarantine'">
252 <xsl:text>quarantine</xsl:text>
253 </xsl:when>
254 <xsl:otherwise>
255 <xsl:text>normal</xsl:text>
256 </xsl:otherwise>
257 </xsl:choose>
258 </xsl:attribute>
259 <xsl:for-each select="policy_evaluated/reason">
260 <xsl:value-of select="type"/>
261 <xsl:text> </xsl:text>
262 <xsl:value-of select="comment"/>
263 <br/>
264 </xsl:for-each>
265 </td>
266 </xsl:template>
267 <xsl:template match="identifiers|identities">
268 <td>
269 <xsl:value-of select="header_from"/>
270 <xsl:if test="count(envelope_to) > 0">
271 <br/>
272 <xsl:value-of select="envelope_to"/>
273 </xsl:if>
274 </td>
275 </xsl:template>
276 <xsl:template match="auth_results">
277 <xsl:apply-templates select="spf"/><!-- one -->
278 <xsl:apply-templates select="dkim"/><!-- zero or more -->
279 </xsl:template>
280 <xsl:template match="dkim|spf">
281 <td>
282 <xsl:attribute name="class">
283 <xsl:variable name="result">
284 <xsl:value-of select="result"/>
285 </xsl:variable>
286 <xsl:choose>
287 <xsl:when test="$result='pass'">
288 <xsl:text>pass</xsl:text>
289 </xsl:when>
290 <xsl:when test="$result='fail' or $result='hardfail'">
291 <xsl:text>fail</xsl:text>
292 </xsl:when>
293 <xsl:when test="$result='temperror' or $result='permerror'">
294 <xsl:text>error</xsl:text>
295 </xsl:when>
296 <xsl:when test="$result='policy'">
297 <xsl:text>dkimpolicy</xsl:text>
298 </xsl:when>
299 <xsl:when test="$result='softfail'">
300 <xsl:text>softfail</xsl:text>
301 </xsl:when>
302 <xsl:otherwise>
303 <xsl:text>normal</xsl:text>
304 </xsl:otherwise>
305 </xsl:choose>
306 </xsl:attribute>
307 <xsl:value-of select="domain"/>
308 <xsl:text> </xsl:text>
309 <xsl:value-of select="human_result"/>
310 </td>
311 </xsl:template>
312 </xsl:stylesheet>
Załączone pliki
Aby odnieść się do załącznika na stronie, użyj attachment:filename, jak pokazano poniżej na liście plików. NIGDY nie używaj URLa [get], ponieważ odnośnik może się zmienić i spowodować utratę informacji, którą chcesz przekazać.Nie możesz załączać plików do niniejszej strony.
