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.
14 When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC request sent to the host server, the
15 XML-RPC response received and the internal evaluation done by the PHP implementation.</p>
17 <p>You can find the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
18 And the source to a functionally identical mail-by-XML-RPC server in the file <a
19 href="../server/server.php?showSource=1">server.php</a> included with the library (look for the 'mail_send'
23 include_once __DIR__ . "/../../src/Autoloader.php";
24 PhpXmlRpc\Autoloader::register();
26 if (isset($_POST["mailto"]) && $_POST["mailto"]) {
27 $server = "http://phpxmlrpc.sourceforge.net/server.php";
28 $req = new PhpXmlRpc\Request('mail.send', array(
29 new PhpXmlRpc\Value($_POST["mailto"]),
30 new PhpXmlRpc\Value($_POST["mailsub"]),
31 new PhpXmlRpc\Value($_POST["mailmsg"]),
32 new PhpXmlRpc\Value($_POST["mailfrom"]),
33 new PhpXmlRpc\Value($_POST["mailcc"]),
34 new PhpXmlRpc\Value($_POST["mailbcc"]),
35 new PhpXmlRpc\Value("text/plain")
38 $client = new PhpXmlRpc\Client($server);
40 $resp = $client->send($req);
41 if (!$resp->faultCode()) {
42 print "Mail sent OK<br/>\n";
44 print "<fonr color=\"red\">";
45 print "Mail send failed<br/>\n";
47 print "Code: " . htmlspecialchars($resp->faultCode()) .
48 " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>";
54 From <input size="60" name="mailfrom" value=""/><br/>
56 To <input size="60" name="mailto" value=""/><br/>
57 Cc <input size="60" name="mailcc" value=""/><br/>
58 Bcc <input size="60" name="mailbcc" value=""/><br/>
60 Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
62 Body <textarea rows="7" cols="60" name="mailmsg">Your message here</textarea><br/>
63 <input type="Submit" value="Send"/>