PHP Code:
class SameSender{
................
function attachedSendMailTo( $mail ){
$un = strtoupper(uniqid(time()));
$head = "From: ".$this->from."<".$this->re.">\r\n";
$head .= "To: ".$mail."\r\n";
$head .= "Subject: ".$this->title."\r\n";
$head .= "X-Mailer: PHPMail Tool\r\n";
$head .= "Reply-To: ".$this->re."\r\n";
$head .= "Mime-Version: 1.0\r\n";
$head .= "Content-Type:multipart/mixed;";
$head .= "boundary=\"----------".$un."\"\n\n";
if ( ($body =& $this->createAttachedBody( $un )) == null)
return;
if (!@mail($mail, $this->title, $body, $head)){
$this->errorEventCode = "cant_send_mail";
}
}
function &createAttachedBody( $un ){
static $body;
if (!isset( $body )){
if (!file_exists( $this->attachFileName )){
$this->errorCode = "not_set_file"; return null;
}
if ( ! $f = @fopen($this->attachFileName,"rb") ){
$this->errorCode = "cant_read_file"; return null;
}
$body = "------------".$un."\nContent-Type:text/html;\n";
$body .= "Content-Transfer-Encoding: 8bit\n\n".$this->text."\n\n";
$body .= "------------".$un."\n";
$body .= "Content-Type: application/octet-stream;";
$body .= "name=\"".basename($this->attachRealName)."\"\n";
$body .= "Content-Transfer-Encoding:base64\n";
$body .= "Content-Disposition:attachment;";
$body .= "filename=\"".basename($this->attachRealName)."\"\n\n";
$body .= chunk_split(base64_encode(fread($f,filesize($this->attachFileName))))."\n";
}
return $body;
}
................
var $title;
var $text;
var $re;
var $attachRealName;
var $attachFileName;
}
may be it will help to you
Bookmarks