PHP
  Home arrow PHP arrow Handling Attachments in 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? 
Google.com  
PHP

Handling Attachments in MIME Email with PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    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:
      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


    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
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek