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 if (isset($_POST["mailto"]) && $_POST["mailto"]) {
17 $server = XMLRPCSERVER;
18 $req = new PhpXmlRpc\Request('mail.send', array(
19 new PhpXmlRpc\Value($_POST["mailto"]),
20 new PhpXmlRpc\Value($_POST["mailsub"]),
21 new PhpXmlRpc\Value($_POST["mailmsg"]),
22 new PhpXmlRpc\Value($_POST["mailfrom"]),
23 new PhpXmlRpc\Value($_POST["mailcc"]),
24 new PhpXmlRpc\Value($_POST["mailbcc"]),
25 new PhpXmlRpc\Value("text/plain")
28 $client = new PhpXmlRpc\Client($server);
30 $resp = $client->send($req);
31 if (!$resp->faultCode()) {
32 print "Mail sent OK<br/>\n";
34 print "<font color=\"red\">";
35 print "Mail send failed<br/>\n";
37 print "Code: " . htmlspecialchars($resp->faultCode()) .
38 " Reason: '" . htmlspecialchars($resp->faultString()) . "'<br/>";
44 From <input size="60" name="mailfrom" value=""/><br/>
46 To <input size="60" name="mailto" value=""/><br/>
47 Cc <input size="60" name="mailcc" value=""/><br/>
48 Bcc <input size="60" name="mailbcc" value=""/><br/>
50 Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
52 Body <textarea rows="7" cols="60" name="mailmsg">Your message here</textarea><br/>
53 <input type="Submit" value="Send"/>
56 </html><?php require_once __DIR__ . "/_append.php"; ?>