PHP
  Home arrow PHP arrow A Better Way to Determine MIME Types f...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
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: 5 stars5 stars5 stars5 stars5 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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


       · This third part of the series shows in a pretty simple fashion, how to refactor the...
     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway