PHP
  Home arrow PHP arrow Handling Attachments in MIME Email wit...
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

Handling Attachments in MIME Email with PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-07-16

    Table of Contents:
  • Handling Attachments in MIME Email with PHP
  • Developing a simple MIME mailer class with PHP 4
  • Working with email attachments
  • Seeing the Mailer class in action

  • 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


    Handling Attachments in MIME Email with PHP


    (Page 1 of 4 )

    In this second tutorial of the series, I’m going to teach you how to improve the initial structure of the MIME mailer class developed in the first article by giving it the ability to work directly with attachments. Sounds fairly interesting, right? Then don’t waste any more time in preliminaries and begin reading this article now!

    Sending plain text email with PHP is a pretty simple task that can be tackled with minor efforts thanks mostly to the easy learning curve of its popular “mail()” built-in function. You know, you code a simple script that sends email messages to a bunch of recipients. It feeds this function with the proper email headers and the text of the message and… voila! The script works like a charm, and best of all, it only took a few minutes to be developed.

    However, things get slightly more complicated when it comes to sending email messages in HTML, or when it’s necessary to work with attachments, since these tasks require the use of MIME, which is the mail extension that permits you to send messages formatted in HTML, include inline files, and so forth.

    The good news concerning the use of MIME email with PHP is that you can develop your own reusable functions in order to send messages in HTML and handle a huge variety of attachments. You can also take advantage of the object-oriented paradigm and create a highly modular MIME mailer class that does all of this hard work for you.

    In either case, in this group of tutorials you’ll find useful material regarding the construction of an expansible PHP class that can be utilized to send MIME-compliant messages very easily and work with different types of attachments.

    And speaking of sending MIME-compliant email messages, in the last article of this series I went through the development of a basic mailer class in PHP 4. It was capable of dispatching plain text messages to a specified recipient by way of an intuitive API. Indeed, the functionality of this class was pretty limited, since it wasn’t capable of working with HTML messages or attachments.

    More PHP Articles
    More By Alejandro Gervasio


       · This second tutorial of the series shows how to improve the initial structure of 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 5 hosted by Hostway