PHP Classes

File: smtptest.php

Recommend this page to a friend!
  Classes of Nic Stevens   Send messages via SMTP   smtptest.php   Download  
File: smtptest.php
Role: Example script
Content type: text/plain
Description: Program to test smtp class
Class: Send messages via SMTP
Send e-mail messages via SMTP connections.
Author: By
Last change:
Date: 18 years ago
Size: 467 bytes
 

Contents

Class file image Download
<?
require_once('smtp.php');

$authdata = "";

$from = "joe@test.com";
$recip = "jay@test.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";
?>