#!/usr/bin/php
<?php
/**
 * test smtpmx mailer
 * 
 * @version 0.3
 * @copyright 2005 gERD Schaufelberger
 * @author gERD Schaufelberger <gerd@php-tools.net>
 * @package test
 * @subpackage test
 */
    
error_reporting(E_ALL);
    
set_include_path(dirname(__FILE__) .':' get_include_path());

    
// email header 
    
$hdr    =    array(
                        
'From'            =>    'you@php.net',
                        
'Subject'        =>    'The plan!',
                        
'Return-Path'    =>    'you@php.net',
                        
'X-Mailer'        =>    'test'
                    
);

    
// email body
    
$bdy    =    'What are we going to do today, Brain?" asks Pinky, the would-be
world-dictator, Brain. "Why, what we always do, Pinky. Plan to take
over the world.'
;
    
    
    
// recieve recipients list from command line
    
array_shift($_SERVER['argv']);
    
$rcpts    =    implode(' '$_SERVER['argv']);
    
    if (empty(
$rcpts)) {
        echo 
"no recipients given\n";
        exit(
0);
    }

    require_once 
'Mail.php';
    
// require_once 'Mail/smtpmx.php';

    // start and configure Mail_smtpmx
    
$params    =    array(
                        
//'mailname'    =>  'mail.mydomain.net',
                        //'netdns' => false,
                        
'debug' => true,
                        
'test'  =>  true,
                    );
    
$mailer    =&    Mail::factory'smtpmx'$params );

    
// send an email...
    
$result    =    $mailer->send$rcpts$hdr$bdy );
    if (
PEAR::isError($result)) {
        echo 
$result->getMessage() . "\n";
        exit(
1);
    }

    exit(
0)
?>