PHP
  Home arrow PHP arrow Page 4 - 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 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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 - Putting the modified “Mailer” class to work


    (Page 4 of 4 )

    Below I coded a final hands-on example that demonstrates how to use the “Mailer” class, after its original signature has been modified.

    Here is the corresponding code sample:


    // create a new instance of the 'Mailer' class

    $mailer=&new Mailer('alejandro@mydomain.com,'mybuddy@yourdomain.com','Testing mailer class','Hello buddy. I am sending you a couple of fun images.');

    // add some attachments

    $mailer->addAttachment('file1.jpg');

    $mailer->addAttachment('file.jpg');

    // send MIME email

    $mailer->send();


    As you can see, changing the way  the “Mailer” class does some of its things doesn’t imply that its API must change too. The above example demonstrates this concept very clearly, since the steps taken to use the class in question are the same steps you learned in the two previous tutorials of the series.

    And lastly, here’s my final suggestion: feel free to introduce your own modifications to the pertaining “Mailer” class, not only to extend its functionality, but to improve your background in sending MIME email with PHP.

    Final thoughts

    In this third episode of the series, I showed you how to improve the business logic of the previous MIME mailer class, specifically when it comes to determining the MIME type of the attached files. As you saw before, this process was performed by creating an additional array of class properties. So you shouldn’t have major problems understanding how it functions.

    In the next article, I’m going to continue extending the functionality of this MIME mailer class by providing it with the capacity to send email messages in HTML format.

    The article will be insightful, trust me. I hope you don’t miss the upcoming tutorial!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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

       

    PHP ARTICLES

    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security





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