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'])
6 highlight_file(__FILE__);
11 <head><title>xmlrpc</title></head>
15 <p>This form enables you to send mail via an XML-RPC server. For public use
16 only the "Userland" server will work (see <a href="http://www.xmlrpc.com/discuss/msgReader$598">Dave Winer's
18 When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC request sent to the host server, the
19 XML-RPC response received and the internal evaluation done by the PHP implementation.</p>
21 <p>You can find the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
22 And the source to a functionally identical mail-by-XML-RPC server in the file <a
23 href="../server/server.php?showSource=1">server.php</a> included with the library (look for the 'mail_send'
28 // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
29 if (!isset($HTTP_POST_VARS) && isset($_POST)) {
30 $HTTP_POST_VARS = $_POST;
33 if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
34 if ($HTTP_POST_VARS["server"] == "Userland") {
38 $XP = "/xmlrpc/server.php";
39 $XS = "pingu.heddley.com";
41 $f = new xmlrpcmsg('mail.send');
42 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
43 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
44 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
45 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
46 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
47 $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
48 $f->addParam(new xmlrpcval("text/plain"));
50 $c = new xmlrpc_client($XP, $XS, 80);
53 if (!$r->faultCode()) {
54 print "Mail sent OK<br/>\n";
56 print "<fonr color=\"red\">";
57 print "Mail send failed<br/>\n";
59 print "Code: " . htmlspecialchars($r->faultCode()) .
60 " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
66 Server <select name="server">
67 <option value="Userland">Userland</option>
68 <option value="UsefulInc">UsefulInc private server</option>
71 From <input size="60" name="mailfrom" value=""/><br/>
73 To <input size="60" name="mailto" value=""/><br/>
74 Cc <input size="60" name="mailcc" value=""/><br/>
75 Bcc <input size="60" name="mailbcc" value=""/><br/>
77 Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
79 Body <textarea rows="7" cols="60" name="mailmsg">Your message here</textarea><br/>
80 <input type="Submit" value="Send"/>