Login   Register  
PHP Classes
elePHPant
Icontem

File: mailexample.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2004-11-27 11:40
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(); ?>