<?php
$m= new Mail; // create the mail
$m->From( "$reply_mail" );
$m->To( "อีเมล์ผู้รับ" );
$m->Subject( "หัวข้อจดหมาย" );
$message= "ข้อความ";
$m->Body( $message); // set the body
//$m->Cc( "[email protected]");
//$m->Bcc( "[email protected]");
$m->Priority(4) ; // set the priority to Low
$m->Attach( "$attache_file", "image/jpeg" ) ; // attach a file of type image/jpeg
//alternatively u can get the attachment uploaded from a form
//and retreive the filename and filetype and pass it to attach methos
$m->Send(); // send the mail
echo "The Fax Already sent:<br><pre>", $m->Get(), "</pre>";
class Mail
{
/*
list of To addresses
@var array
*/
var $sendto = array();
/*
@var array
*/
var $acc = array();
/*
@var array
*/
var $abcc = array();
/*
paths of attached files
@var array
*/
var $aattach = array();
/*
list of message headers
@var array
*/
var $xheaders = array();
/*
message priorities referential
@var array
*/
var $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
/*
character set of message
@var string
*/
var $charset = "us-ascii";
var $ctencoding = "7bit";
var $receipt = 0;
var $content_type='';
activate or desactivate the email addresses validator
ex: autoCheck( true ) turn the validator on
by default autoCheck feature is on
@param boolean $bool set to true to turn on the auto validation
@access public
*/
function autoCheck( $bool )
{
if( $bool )
$this->checkAddress = true;
else
$this->checkAddress = false;
}
/*
Define the subject line of the email
@param string $subject any monoline string
/* Body( text [, charset] )
* set the body (message) of the mail
* define the charset if the message contains extended characters (accents)
* default to us-ascii
* $mail->Body( "m้l en fran็ais avec des accents", "iso-8859-1" );
*/
function Body( $body, $charset="windows-874" )
{
$this->body = $body;
/* Priority( $priority )
* set the mail priority
* $priority : integer taken between 1 (highest) and 5 ( lowest )
* ex: $mail->Priority(1) ; => Highest
*/
@param string $filename : path of the file to attach
@param string $filetype : MIME-type of the file. default to 'application/x-unknown-content-type'
@param string $disposition : instruct the Mailclient to display the file if possible ("inline") or always as a link ("attachment") possible values are "inline", "attachment"
*/
function Attach($filename,$filetype = "",$disposition = "inline")
{
$this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\n";
$this->fullBody .= "Content-Type: text/html; charset=$this->charset\nContent-Transfer-Encoding: $this->ctencoding\n\n" . $this->body ."\n";
$sep= chr(13) . chr(10);
$ata= array();
$k=0;
// for each attached file, do...
for( $i=0; $i < count( $this->aattach); $i++ ) {
$filename = $this->aattach[$i];
$basename = basename($filename);
$ctype = $this->actype[$i]; // content-type
$disposition = $this->adispo[$i];
/*getting the original name of the file */
the semicolon after the Content-type : $basename is important
since it was not there.This mail program
was not able to see the attachment for the past 1 month
--Saravanan 20/04/02