PHP Classes
elePHPant
Icontem

File: smtp_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Steffen Stollfu▀  >  smtp.class.inc  >  smtp_test.php  >  Download  
File: smtp_test.php
Role: Example script
Content type: text/plain
Description: Test File for smtp.class.inc
Class: smtp.class.inc
provide access on the smtp protocol
Author: By
Last change: Use the new class now
Date: 7 years ago
Size: 1,336 bytes
 

Contents

Class file image Download
<?php
/*
 * @package: smtp.class.inc
 * @author: Steffen 'j0inty' Stollfu├č
 * @created 12.06.2008
 * @copyright: Steffen 'j0inty' Stollfu├č
 * @version: 0.2-dev
 */
$rootPath = "./";
function
__autoload($class)
{
    global
$rootPath;
    require_once(
$rootPath. strtolower($class).".class.inc");
}

$strLogFile = $rootPath ."smtp.log";

$smtpServer = "smtp.your_domain.de";
$smtpPort = 25;
$smtpUser = "";
$smtpPass = "";
$IPv6 = false;
$arrConnectionTimeout = array("sec" => 5, "usec" => 0);

$from = "hans_meier@web.de";
$to = array("max_muster_mann@web.de","sonja_muster_frau@web.de");
$cc = "klaus@muster_domain.de";
$bcc = null;

$optinalHeaders = array( "Content-Type: text/plain; charset=\"utf-8\"",
                        
"Reply-To: ". $from
               
);

$subject = "Hello World";
$message = "├Ą├Â├╝├ä├ľ├ť├č\r\nHello World,\r\nNice to meet you ;)\r\nregards\r\nj0inty";

try
{
   
$smtp = new SMTP($strLogFile);
   
   
$smtp->connect($smtpServer,$smtpPort,$arrConnectionTimeout,$IPv6);
   
    if(
$smtpUser != "" )
    {
       
$smtp->login($smtpUser,$smtpPass);
    }
   
    for(
$i=0;$i<1;$i++ )
       
$smtp->sendMessage($from,$to,$subject,$message,$optinalHeaders,$cc,$bcc,SMTP::MESSAGE_PRIO_HIGH);
   
   
$smtp->disconnect();
}
catch(
SMTP_Exception $e )
{
   
$e->saveToFile($rootPath. "smtp_expections.log");
    echo
$e;
}

?>