cPHPezMail Version 1.2
COPYRIGHT 2004-2005 CHARIN NAWARITLOHA.
Contact: inews@charinnawaritloha.net
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('myself@myemail.com', '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('someone@mailserver.com', 'Your Name');
$cMail->AddTo('xxxx-x@xxxthai.com', 'Peter Norton');
$cMail->AddTo('yyyy1234@yybo.co.th', 'Bill Gate');
$cMail->AddCc('some_one@oneway123.com', 'Screen Name is optional');
$cMail->AddCc('some_two@oneway123.com');
$cMail->AddCc('some_three@oneway123.com', 'Mishell Mable');
$cMail->AddBcc('some_one@hotmail.com', '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 |