Login   Register  
PHP Classes
elePHPant
Icontem

File: smtptest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2006-03-07 20:18
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";
?>