2 // Allow users to see the source of this file even if PHP is not configured for it
3 if ((isset($HTTP_GET_VARS['showSource']) && $HTTP_GET_VARS['showSource']) ||
4 (isset($_GET['showSource']) && $_GET['showSource']))
5 { highlight_file(__FILE__); die(); }
8 <head><title>xmlrpc</title></head>
11 <p>This form enables you to send mail via an XML-RPC server. For public use
12 only the "Userland" server will work (see <a href="http://www.xmlrpc.com/discuss/msgReader$598">Dave Winer's message</a>).
13 When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC request sent to the host server, the XML-RPC response received and the internal evaluation done by the PHP implementation.</p>
14 <p>You can find the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
15 And the source to a functionally identical mail-by-XML-RPC server in the file <a href="../server/server.php?showSource=1">server.php</a> included with the library (look for the 'mail_send' method)</p>
17 include("xmlrpc.inc");
19 // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
20 if (!isset($HTTP_POST_VARS) && isset($_POST))
21 $HTTP_POST_VARS = $_POST;
23 if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
24 if ($HTTP_POST_VARS["server"]=="Userland") {
25 $XP="/RPC2"; $XS="206.204.24.2";
27 $XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
29 $f=new xmlrpcmsg('mail.send');
30 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
31 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
32 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
33 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
34 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
35 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
36 $f->addParam(new xmlrpcval("text/plain"));
38 $c=new xmlrpc_client($XP, $XS, 80);
41 if (!$r->faultCode()) {
42 print "Mail sent OK<br/>\n";
44 print "<fonr color=\"red\">";
45 print "Mail send failed<br/>\n";
47 print "Code: " . htmlspecialchars($r->faultCode()) .
48 " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
54 Server <select name="server"><option value="Userland">Userland</option>
55 <option value="UsefulInc">UsefulInc private server</option></select>
57 From <input size="60" name="mailfrom" value=""/><br/>
59 To <input size="60" name="mailto" value=""/><br/>
60 Cc <input size="60" name="mailcc" value=""/><br/>
61 Bcc <input size="60" name="mailbcc" value=""/><br/>
63 Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
65 Body <textarea rows="7" cols="60" name="mailmsg">Your message here</textarea><br/>
66 <input type="Submit" value="Send"/>