Skip to main content

PHP Mail Class

Published on
Mailer is a PHP class to help provide easier use of the PHP mail() function and error support. In all other of my scripts using the mail() function I would have lines upon lines of code just to make sure every thing sent right and provide my own error checking. This helps cut down on that process.  Check out the Mailer side page for a detailed break down on how it works, or just look at the example below for a pretty self explanatory usage.

$mymail = new Mailer('[email protected]');
//From() is optional, can be defined within class manually
$mymail->From('Name', '[email protected]');

$mymail->Subject('Test email');
if(!$mymail->Send()) {
echo $mymail->Error();
} else {
echo 'It worked!';

You can download the Mailer PHP Class source files.