PHP Classes
elePHPant
Icontem

File: SMTPs_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Randy Martinsen  >  SMTPs  >  SMTPs_test.php  >  Download  
File: SMTPs_test.php
Role: Example script
Content type: text/plain
Description: Sample test script
Class: SMTPs
Compose and send e-mail messages via SMTP
Author: By
Last change:
Date: 7 years ago
Size: 1,195 bytes
 

Contents

Class file image Download
<?php

//include 'debug.php';

include 'SMTPs.php';

$objSMTP = new SMTPs ();

// Be sure to set variables in the configuration file SMTPs.ini.php used by SMTPs.php

$body = "<p>This is the <b>HTML portion</b> of the mixed message.</p>"; //Can't use html that includes quotes
echo "HTML: ".$body."<hr>";


 
# Text Version
 
$msg = str_replace("<br>", "\n", $body);
 
$msg = str_replace("<p>", "\n\n", $msg);
 
$msg = str_replace("<BR>", "\n", $msg);
 
$msg = str_replace("<P>", "\n\n", $msg);
 
$msg = str_replace("<br />", "\n", $msg);
 
$text .= strip_tags($msg);
echo
"Text: ".$text."<hr>";

$objSMTP->setDebug(true);

$objSMTP->setConfig('./SMTPs.ini.php');

$objSMTP->setFrom ( 'Randy Martinsen <randym56@hotmail.com>' ); //using a name and properly formed e-mail lowers spam count by .1

$objSMTP->setTo ( 'Randy <randymartinsen@yahoo.com>' );

$objSMTP->setCC ( '' );

$objSMTP->setBCC ( '' );

$objSMTP->setSubject ( 'an interesting Subject' );

$objSMTP->setBodyContent ($text);

$objSMTP->setBodyContent ( $body, 'html' );


$objSMTP->sendMsg();


echo (
'<hr />Processed<br>' . $objSMTP->getErrors());
//do_print_r ( $objSMTP );

?>