1 <?php require_once __DIR__ . "/_prepend.php"; ?><html lang="en">
2 <head><title>xmlrpc - Mail demo</title></head>
6 <p>This form enables you to send mail via an XML-RPC server.
7 When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC request sent to the host server, the
8 XML-RPC response received and the internal evaluation done by the PHP implementation.</p>
10 <p>You can see the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
11 And the source to a functionally identical mail-by-XML-RPC server in the file <a
12 href="../server/server.php?showSource=1">server.php</a> included with the library (look for the 'mail_send'
16 // Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
17 include_once __DIR__ . "/../../src/Autoloader.php";
18 PhpXmlRpc\Autoloader::register();
20 if (isset($_POST["mailto"]) && $_POST["mailto"]) {
21 $server = XMLRPCSERVER;
22 $req = new PhpXmlRpc\Request('mail.send', array(
23 new PhpXmlRpc\Value($_POST["mailto"]),
24 new PhpXmlRpc\Value($_POST["mailsub"]),
25 new PhpXmlRpc\Value($_POST["mailmsg"]),
26 new PhpXmlRpc\Value($_POST["mailfrom"]),
27 new PhpXmlRpc\Value($_POST["mailcc"]),
28 new PhpXmlRpc\Value($_POST["mailbcc"]),
29 new PhpXmlRpc\Value("text/plain")
32 $client = new PhpXmlRpc\Client($server);
34 $resp = $client->send($req);
35 if (!$resp->faultCode()) {
36 print "Mail sent OK<br/>\n";
38 print "<font color=\"red\">";
39 print "Mail send failed<br/>\n";
41 print "Code: " . htmlspecialchars($resp->faultCode()) .
42 " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>";
48 From <input size="60" name="mailfrom" value=""/><br/>
50 To <input size="60" name="mailto" value=""/><br/>
51 Cc <input size="60" name="mailcc" value=""/><br/>
52 Bcc <input size="60" name="mailbcc" value=""/><br/>
54 Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
56 Body <textarea rows="7" cols="60" name="mailmsg">Your message here</textarea><br/>
57 <input type="Submit" value="Send"/>
60 </html><?php require_once __DIR__ . "/_append.php"; ?>