PHP Classes

cPHPezMail: Send text and HTML email messages with attachments

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 63%Total: 2,144 All time: 1,825 This week: 94Up
Version Licenses Categories
cphpezmail 1.0.0Artistic License, B...Email


This class can be used to compose and send e-mail messages.

The messages may be in plain text or HTML or both.

The messages may also include one or more attachment files from the server file system or being uploaded to the server via Web forms. The class can recognize the MIME type from the file name extension.

The headers for the subject, sender, recipients, character set, encoding and other headers may be configured.

Picture of Charin Nawaritloha
Name: Charin Nawaritloha <contact>
Classes: 1 package by
Country: Thailand Thailand
Age: ???
All time rank: 14203 in Thailand Thailand
Week rank: 346 Up1 in Thailand Thailand Up


cPHPezMail Version 1.2 COPYRIGHT 2004-2005 CHARIN NAWARITLOHA. Contact: This Script Developed under GNU GENERAL PUBLIC LICENSE, please see GNU-English.txt Feature: - Object Base Script, EASY to use with your PHP script. - Support Plain Text, HTML and Plain Text + HTML format - Support multiple reciepients To:, Cc: and Bcc: - Support E-mail address with Screen Name format. - Support attach POST file (Upload from your html form - $_FILES). - Support attach Local file (Files in your webhost or harddisk). - Auto-detected MIME file type. - Export your E-mail to .eml format (this format support in e-mail clients like MS-Outlook). Installation: 1. Open file "inc_cPHPezMail.php" in text editor and modifies values in function cPHPezMail() then save changes. 2. Copy file "inc_cPHPezMail.php" to your webhost. 3. Create directory match $sTempFileName and change mode to 777 (in Unix host) to store upload file (because most webhost run PHP in Safe Mode so you can't open file outside the specified directory) 4. In your script please include file "inc_cPHPezMail.php" and create a new object with $cYourVal = new cPHPezMail(); Configuration: You can edit cPHPezMail configulation, go to function cPHPezMail() and edit this value... //MIME Boundary $this->sMimeBoundary = '==Multipart_Boundary_X'. md5(time()) .'X'; $this->sAltBoundary = '==Alternative_Boundary_X'. md5(time()) .'X'; //Charset and Encoding Bit for Plain Text and HTML $this->sCharset = 'iso-8859-1'; $this->nEncoding = 7; //target directory+filename to copy uploaded files. $this->sTempFileName = './upload_temp/' . md5(time()) . '.tmp'; //if your mime type of attach file does not match in list, it use this value $this->sDefaultMimeType = 'application/octet-stream'; //add or modify your mine type here. $this->aMimeType = array(...); //and after line 199, if you want to make default value TO DO here $this->AddHeader('MIME-Version', '1.0'); $this->AddBcc('', 'My FullName'); NOTICE!!!! Prevent editing method-source-code-area , use OOP - extends instead. Example: [in your html form] <form action="yourPHPscript.php" method="POST" enctype="multipart/form-data"> <input type="file" name="fileX"> </form> [in your PHP script] <?php require_once('inc_cPHPezMail.php'); $cMail = new cPHPezMail(); //Don't try to add invalid e-mail address format $cMail->SetFrom('', 'Your Name'); $cMail->AddTo('', 'Peter Norton'); $cMail->AddTo('', 'Bill Gate'); $cMail->AddCc('', 'Screen Name is optional'); $cMail->AddCc(''); $cMail->AddCc('', 'Mishell Mable'); $cMail->AddBcc('', 'Perter Hotmail'); $cMail->SetSubject('This is subject - cPHPezMail Testing...'); $cMail->SetBodyText('This is Text format mail mail.'); $cMail->SetBodyHTML('<HTML>This is HTML format <br>Test Test <b>Body Body</b> mail mail</HTML>'); $cMail->SetCharset('TIS-620'); $cMail->SetEncodingBit(8); //Attach POST file if(isset($_FILES['fileX'])) { $cMail->AddAttachPOSTFile($_FILES['fileX']); } //Attach local file $cMail->AddAttachLocalFile('./index.php', 'text/plain'); $cMail->AddAttachLocalFile('./header.js'); $cMail->AddAttachLocalFile('./makejs.php', 'MIME type is optional'); //if you want to export as eml format do this... $sEMLData = $cMail->ExportEML(); //send your e-mail $cMail->Send(); ?> How to support my script: ------------------------ - Please Votes & Reviews this script. - Send comments to me. - Send E-Card to me. HISTORY: -------- Version 1.2 Release 2005-09-09 - fixed incorrect attach local file(s) [thank you Wouter from Holland, reported this bug] Version 1.1 Release 2005-07-14 - fixed can't attach file(s) when send only plain text e-mail. Version 1.0 Release 2004-04-12 - first release

  Files folder image Files  
File Role Description
Accessible without login HTML file GNU-ThaiTranslation.html Lic. GNU-Thai Translation
Plain text file inc_cPHPezMail.php Class cPHPezMail
Accessible without login Plain text file readme_en.txt Doc. Document

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:1,825
This week:94Up
User Ratings User Comments (1)
 All time
14 years ago (kishore kumar)