News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
A Better Way to Determine MIME Types for MIME Email with PHP
July 24, 2008 @ 07:53:18

Continuing on in their look at sending MIME emails with PHP, DevShed has posted a better way for you to determine the correct MIME type of the file you're wanting to send (third part of the series).

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. [...] However, the logic implemented by this method is rather primitive and can definitely be improved.

They start with a review of the previous code (PHP4) and show how to get the correct mime type of the file based on the extension mapped to an array of types.

0 comments voice your opinion now!
mime tutorial type mail php4 class getmimetypes extension


blog comments powered by Disqus

Similar Posts

PHP-Tip-a-Day: PHP Tutorial: The Allegory of The Factory Pattern

Johannes Schluter's Blog: A hidden gem in PHP 5.3: fileinfo

DevX.com: Base Concepts of Internationalization in PHP

CodeIgniter Blog: CodeIgniter Community Voice - Generating PDF files using CodeIgniter

Jani Hartikainen's Blog: PHP typehinting gotcha in exceptions/methods


Community Events

Don't see your event here?
Let us know!


version framework community introduction interview podcast extension unittest api library laravel5 release example series list laravel php7 language voicesoftheelephpant opinion

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework