PHP mailing


A word from our sponsors: Play Sudoku online at Internetsudoku.net!


define('DISPLAY_XPM4_ERRORS', true); // display XPM4 errors
require_once '/path-to/MAIL.php'; // path to 'MAIL.php' file from XPM4 package
$m = new MAIL; // initialize MAIL class
$m->From('me@myaddress.net'); // set from address
$m->AddTo('client@destination.net'); // add to address
$m->Subject('Hello World!'); // set subject
$m->Text('Text message.'); // set text message
// send mail local and print result
echo $m->Send() ? 'Mail sent !' : 'Error !';
print_r($m->History); // optional, for debugging
As you can see from this php code example, you can control errors, validate input data (and in the same time you are protected from mail header injection), trace result(s) and most important, if you have entered invalid data, the coresponding error will point to your php code for easy debugging.