Zend Certified Engineer

phpguru.org

Quality PHP, Javascript and C# code
Download RGraph: HTML5 canvas graph library... Home ~ Downloads ~ FAQs ~ Licensing
RSS Feed RSS Feed
Follow me on Twitter Follow me on Twitter

Articles

HTML5

Javascript

PHP5

PHP4


Licensing

All the code here is covered by the PHPGuru license. A short summary is that for any sort of commercial use there is a small one-off licensing fee to pay, and for charity and educational use there is a reduced license fee.

You can read more about licensing here (where there's also a link to Google Checkout).

SMTP mail sending utility for PHP5

This is a utility for PHP5 for connecting to and sending email via SMTP servers.

Code sample

try {
    $smtp = new SMTP($server, $port, $helo, $auth, $user, $pass);
    $smtp->dbug = true;
    $smtp->Connect();
    $smtp->Send(array($recipient),                // Array of recipient addresses
                $from,                            // SMTP From address
                array('Subject' => 'The subject', // The subject of the email
                      'To'      => $recipient,    // The recipient of the email
                      'From'    => $from),        // The emails headers
                $message);                        // The emails body

} catch (SMTPException $e) {
    echo $e->GetMessage();
}