2 // Allow users to see the source of this file even if PHP is not configured for it
3 if (isset($_GET['showSource']) && $_GET['showSource']) {
4 highlight_file(__FILE__);
9 <head><title>xmlrpc - Mail demo</title></head>
13 <p>This form enables you to send mail via an XML-RPC server. For public use
14 only the "Userland" server will work (see <a href="http://www.xmlrpc.com/discuss/msgReader$598">Dave Winer's
16 When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC request sent to the host server, the
17 XML-RPC response received and the internal evaluation done by the PHP implementation.</p>
19 <p>You can find the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
20 And the source to a functionally identical mail-by-XML-RPC server in the file <a
21 href="../server/server.php?showSource=1">server.php</a> included with the library (look for the 'mail_send'
25 include_once __DIR__ . "/../../src/Autoloader.php";
26 PhpXmlRpc\Autoloader::register();
28 if (isset($_POST["server"]) && $_POST["server"]) {
29 if ($_POST["server"] == "Userland") {
30 $server = "http://206.204.24.2/RPC2";
32 $server = "http://pingu.heddley.com/xmlrpc/server.php";
34 $req = new PhpXmlRpc\Request('mail.send', array(
35 new PhpXmlRpc\Value($_POST["mailto"]),
36 new PhpXmlRpc\Value($_POST["mailsub"]),
37 new PhpXmlRpc\Value($_POST["mailmsg"]),
38 new PhpXmlRpc\Value($_POST["mailfrom"]),
39 new PhpXmlRpc\Value($_POST["mailcc"]),
40 new PhpXmlRpc\Value($_POST["mailbcc"]),
41 new PhpXmlRpc\Value("text/plain")
44 $client = new PhpXmlRpc\Client($server);
46 $resp = $client->send($req);
47 if (!$resp->faultCode()) {
48 print "Mail sent OK<br/>\n";
50 print "<fonr color=\"red\">";
51 print "Mail send failed<br/>\n";
53 print "Code: " . htmlspecialchars($resp->faultCode()) .
54 " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>";
60 Server <select name="server">
61 <option value="Userland">Userland</option>
62 <option value="UsefulInc">UsefulInc private server</option>
65 From <input size="60" name="mailfrom" value=""/><br/>
67 To <input size="60" name="mailto" value=""/><br/>
68 Cc <input size="60" name="mailcc" value=""/><br/>
69 Bcc <input size="60" name="mailbcc" value=""/><br/>
71 Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
73 Body <textarea rows="7" cols="60" name="mailmsg">Your message here</textarea><br/>
74 <input type="Submit" value="Send"/>