Location: PHPKode > projects > EXtensible Production Suite (XPS) > xpsdev/helpers/xpm3/DOCUMENTATION/examples.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>XPM3 Examples</title>
<style>
body, pre {
	font-family: Verdana;
	font-size: 10pt;
}
</style>
</head>
<body bgcolor="#f1f3f5" topmargin="10" leftmargin="14">

<pre>
XPM3 <b>Examples</b>
<hr>
<i>Notice</i>: for more informations, XPM3 package contain a folder "EXAMPLES".

Send an e-mail:
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
// path to XPM3_MAIL.php from XPM3 package
require_once '/path/XPM3_MAIL.php';

$m = new XPM3_MAIL;
$m->From('hide@address.com'); // From mail address
$m->AddTo('hide@address.com'); // To mail address
$m->Text('It is simple to use XPM3.'); // Body text/plain message
$s = $m->Send('Hello World!'); // Subject message

// print result(s)
if ($s) echo 'Success!'; // if this mail was successfully sent
else print_r($m->result); // if an error occured
</code></pre>
</td></tr>
</table>

Read an e-mail:
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
// path to XPM3_POP3.php from XPM3 package
require_once '/path/XPM3_POP3.php';

// connect to POP3 mail server with username and password authentication
$conn = XPM3_POP3::Connect('pop.domain.tld', 'username', 'password') or die('Can not connect!');
// get the last mail
$recv = XPM3_POP3::Receive($conn, -1);
// quit and close connection
XPM3_POP3::pQuit($conn);

// print result(s)
if ($recv) print_r($recv); // if last mail was successfully received (read)
else echo 'Can not read!'; // if an error occured or MailBox is empty
</code></pre>
</td></tr>
</table>

<hr color="white">

[ <a style="color: blue; text-decoration: none" href="mailto:hide@address.com?subject=XPM3 Comment Examples">Comments</a> ]

Last update: Thursday, November 30, 2006

</pre>

</body>
</html>
Return current item: EXtensible Production Suite (XPS)