PHP
  Home arrow PHP arrow A Better Way to Determine MIME Types for MIME Email with PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

A Better Way to Determine MIME Types for MIME Email with PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2008-07-23


    Table of Contents:
  • A Better Way to Determine MIME Types for MIME Email with PHP
  • Review: sending MIME-compliant email messages with PHP 4
  • Modifying the signature of the “Mailer” class
  • Putting the modified “Mailer” class to work

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    A Better Way to Determine MIME Types for MIME Email with PHP
    ( Page 1 of 4 )

    Welcome to the third episode of the series entitled “Sending MIME email with PHP.” This series progressively teaches you how to construct a reusable MIME mailer class that can be easily integrated into your existing PHP applications. In this article, I’ll be modifying the implementation of the “getMimeTypes()” method, included with this mailer class, in order to make it more compact and efficient.

    If you’re a PHP developer who has spent a long time building web applications, then you’re probably aware of the remarkable capabilities offered by email. This capacity has been built around the PHP native “mail()” function, which, as you know, facilitates the development of email-related scripts.

    However, this beautiful and peaceful scenario can quickly turn into a raging storm, specifically in those cases when you need to send email messages in HTML format and work with attachments. Here’s where MIME comes in handy, since this mail extension allows you to perform all of these tasks with minor hassles, even though it might take some time to master its most complex features.

    However, if you’re interested in learning how to use an object-oriented approach to build a highly modular PHP class that sends fully-compliant MIME email messages, while also working with file attachments, you’ve come to the right place.

    And now that you’ve been introduced to the principal subject of this PHP series, let me briefly refresh the topics that I discussed in the last article, in case that you’ve not had the chance to read it. In it, I demonstrated how to build a modular MIME mailer class in PHP 4; it was provided with the capacity to send messages in plain text, and to work with different types of file attachments.

    This class implements a private method, called “getMimeTypes(),” which, as its name would suggest, comes in handy for determining the correct MIME type of a given file. As you know, this process is required to assemble the different parts of a multi-part MIME-based message correctly. However, the logic implemented by this method is rather primitive and can definitely be improved.

    Are you ready to continue this educational journey? Let’s get started!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT