File: mail.test.php

Recommend this page to a friend!
  Classes of Steven Hoyt  >  PHP Class Mime Mail  >  mail.test.php  >  Download  
File: mail.test.php
Role: Example script
Content type: text/plain
Description: Example
Class: PHP Class Mime Mail
Compose and send email messages using sendmail
Author: By
Last change:
Date: 1 year ago
Size: 2,230 bytes
 

Contents

Class file image Download
<?php
use Shared\Utilities\Mail\SendMail;
$logo = 'world1.png';
$html = <<<EOT
<html>
            <style>
              body
              {
                font-family : tahoma, verdana, arial;
                font-size : 12pt;
              }
            </style>
            <body>
              <h3>
$title</h3>
              <div>
                <br>
                Please see the attached which was processed and distributed by [SOME APPLICATION].
                <br>
                <br>
                You have received this email because you are on one of its distribution lists ([THIS PARTICULAR ONE]); please contact
                <a href="mailto:help.me@example.com?subject=Mailing List">HELP ME</a> if you would like to be removed.
                <br>
                <br>
                Thank you.
                <br>
                <br>
                <br>
                <br>
              </div>
              <img alt="[THIS COMPANY'S LOGO]" border="0px" src="cid:
$logo">
            </body>
          </html>
EOT;
$text = <<<EOT
Please see the attached which was processed and distributed by [SOME APPLICATION].


                You have received this email because you are on one of its distribution lists ([THIS PARTICULAR ONE]); please contact
                HELP ME (help.me@example.com) if you would like to be removed.


                Thank you.
EOT;
try
{
 
$mail = new SendMail();
 
$mail->attachments = 'c:/program files/apache24/icons/up.gif';
 
$mail->attachments = 'c:/program files/apache24/icons/README.html';
 
$mail->embedded = 'c:/program files/apache24/icons/' . $logo;
 
$mail->recipients = 'Me <me@example.com>';
 
$mail->recipients = 'You <you@example.com>';
 
$mail->subject = 'SendMail Test';
 
$mail->html = $html;
 
$mail->text = $text;
 
$mail->send();
} catch (
Exception $exception) {
  echo
'<pre style="font:11px courier new; text-align:left;">' . print_r($exception->getMessage(), true) . '</pre>';
} finally {
  echo
'<pre style="font:11px courier new; text-align:left;">' . print_r($mail, true) . '</pre>';
}


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