PHP Classes

PHP Class Mime Mail: Compose and send email messages using sendmail

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 141 This week: 1All time: 9,190 This week: 560Up
Version License PHP version Categories
mimemailx 1.0GNU General Publi...1Email, PHP 5, Unix
Description 

Author

This class can compose and send email messages using sendmail.

It provides class variables that can be set to define the email message content like the subject, sender, recipients, HTML or text for the body, attached and embedded files.

The class can assemble the message MIME data and passes it to the sendmail program, so it can queue the message for delivery.

Picture of Steven Hoyt
  Performance   Level  
Name: Steven Hoyt <contact>
Classes: 3 packages by
Country: United States United States
Age: ???
All time rank: 3488466 in United States United States
Week rank: 411 Up48 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Example

<?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>';
}


  Files folder image Files  
File Role Description
Accessible without login Plain text file mail.test.php Example Example
Plain text file SendMail.php Class Bare-bones MIME mailer

 Version Control Unique User Downloads Download Rankings  
 0%
Total:141
This week:1
All time:9,190
This week:560Up
User Comments (1)