Location: PHPKode > scripts > MIME Mail and SMTP > mime-mail-and-smtp/mailexample.txt
<?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("hide@address.com", "To");
$testmail->setsender("hide@address.com", "A. J. Somebody");
$testmail->setreturn("hide@address.com");
$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(); ?>
Return current item: MIME Mail and SMTP