PHP Classes

File: mailexample.txt

Recommend this page to a friend!
  Classes of Devin Doucette   MIME Mail and SMTP   mailexample.txt   Download  
File: mailexample.txt
Role: Example script
Content type: text/plain
Description: Simple example of the script
Class: MIME Mail and SMTP
Send HTML or plain text emails with attachments
Author: By
Last change:
Date: 19 years ago
Size: 921 bytes
 

Contents

Class file image Download
<?php
require("./mail.php");

$htmlexample = <<<EOF
<html>
<body>
<div style="font:10pt Verdana;">This is the example email</div>
</body>
</html>
EOF;

$testmail = new mimemail();
$testserver = new smtpmail("shawmail");

$testmail->addrecipient("darksnoopy@shaw.ca", "To");
$testmail->setsender("example@test.com", "A. J. Somebody");
$testmail->setreturn("darksnoopy@shaw.ca");
$testmail->setsubject("This is my example email");

$testmail->sethtml($htmlexample);

// This call is unnecessary, as if it is not made, the same thing
// will be send as plain text anyways.
$testmail->setplain("This is the example email.");

$testmail->addattachment("./mail.php");
$testmail->addattachment("Test.txt", "This is my example attachment");

$testmail->compilemail();

$testserver->openconnection();
$testserver->sendmail($testmail->headers, $testmail->message);
$testserver->closeconnection(); ?>