Location: PHPKode > scripts > Send messages via SMTP > send-messages-via-smtp/smtptest.php
<?
require_once('smtp.php');

$authdata = "";

$from = "hide@address.com";
$recip = "hide@address.com";
$msgdata = `fortune -s`;
$headers = "Subject: A test message from " . $argv[0];
try {
    $smtp = new smtp("localhost",25,$from,$recip,$headers,$authdata,$msgdata);
} catch (Exception $e) {
    echo "SMTP ERROR: " . $e->getCode() . ": " . $e->getMessage() . " in " . $e->getFile() . "(" . $e->getLine() . ")\n";
    exit;
}
echo "Message sent.\n";
?>
	
Return current item: Send messages via SMTP