File: SMTPs_test.php

Recommend this page to a friend!
  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: 13 years ago
Size: 1,195 bytes


Class file image Download

//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);
"Text: ".$text."<hr>";



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

$objSMTP->setTo ( 'Randy <>' );

$objSMTP->setCC ( '' );

$objSMTP->setBCC ( '' );

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

$objSMTP->setBodyContent ($text);

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


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


For more information send a message to info at phpclasses dot org.