Wiki source code of Mail test
Version 2.1 by Administrator on 08.09.2023 13:42
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{velocity}} | ||
2 | #if($xwiki.hasAccessLevel('admin')) | ||
3 | #if("$!{request.action}" == 'send_mail' && "$!{request.lastname}" == '') | ||
4 | ## Check submission and honey pot. | ||
5 | #if("$!request.recipient" != '' && "$!request.subject" != '') | ||
6 | #set($result = $xwiki.mailsender.sendTextMessage("nobody@vsb.cz", $request.recipient, $request.subject, "$!request.message")) | ||
7 | #if($result == -1) | ||
8 | {{error}}A problem occurred while sending the mail: $context.error{{/error}} | ||
9 | #else | ||
10 | {{info}}Everything went OK.{{/info}} | ||
11 | #end | ||
12 | #else | ||
13 | {{error}}Please specify at least a recipient and a subject{{/error}} | ||
14 | #end | ||
15 | #end | ||
16 | |||
17 | {{html wiki=true}} | ||
18 | <form action="" method="post"> | ||
19 | <input name="action" value="send_mail" type="hidden" /> | ||
20 | ## this is a honey-pot hidden text field hat hopefully robots will not leave empty | ||
21 | <div class="hidden"> | ||
22 | <input name="lastname" type="text" /> | ||
23 | </div> | ||
24 | <fieldset> | ||
25 | **TO:**<br /> | ||
26 | <input type="text" name="recipient" /><br /> | ||
27 | **SUBJECT:**<br /> | ||
28 | <input type="text" name="subject" /><br /> | ||
29 | **MESSAGE:**<br /> | ||
30 | <textarea name="message" style="width:99%;" rows=10>Your test message here.</textarea> | ||
31 | </fieldset> | ||
32 | <div> | ||
33 | <span class="buttonwrapper"><input type="submit" class="button" value="Send" /></span> | ||
34 | </div> | ||
35 | </form> | ||
36 | {{/html}} | ||
37 | #else | ||
38 | {{error}}Oops. Area restricted to Admins, sorry.{{/error}} | ||
39 | #end | ||
40 | {{/velocity}} |