note 80581 added to ref.mail
| From: | JakubJ at osu1 dot php dot net | Date: | Wed, 23 Jan 2008 14:29:33 +0000 |
| Subject: | note 80581 added to ref.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135334@lists.php.net to get a copy of this message | ||
Hey guys, I need your help. I had a developer make us a website. Were using win2k3 to run the
website via IIS. We got most to work but the mail function, because it was made to run on a linux
system and mines windows. Here is the code:
<?php
/*----------------------------------------------------*/
/* Created By Mariayn Mladenov - slackrover.com */
/* */
/* 04.Oct.2006 */
/*----------------------------------------------------*/
class MailClass
{
var $Reciever;
var $Subject ;
var $Message;
var $Sender;
var $Content;
var $Charset;
var $Encoding;
var $BCC;
var $Attachment;
var $AttachmentType;
var $AttachmentName;
var $Chars = array( "а"=>"a",
"б"=>"b",
"в"=>"v",
"г"=>"g",
"д"=>"d",
"е"=>"e",
"ж"=>"j",
"з"=>"z",
"и"=>"i",
"й"=>"j",
"к"=>"k",
"л"=>"l",
"м"=>"m",
"н"=>"n",
"о"=>"o",
"п"=>"p",
"Ñ"=>"r",
"Ñ"=>"s",
"Ñ"=>"t",
"Ñ"=>"u",
"Ñ"=>"f",
"Ñ
"=>"h",
"Ñ"=>"c",
"Ñ"=>"ch",
"Ñ"=>"sh",
"Ñ"=>"sht",
"Ñ"=>"u",
"Ñ"=>"io",
"Ñ"=>"iu",
"Ñ"=>"ya",
"Ð"=>"A",
"Ð"=>"B",
"Ð"=>"V",
"Ð"=>"G",
"Ð"=>"D",
"Ð"=>"E",
"Ð"=>"J",
"Ð"=>"Z",
"Ð"=>"I",
"Ð"=>"J",
"Ð"=>"K",
"Ð"=>"L",
"Ð"=>"M",
"Ð"=>"N",
"Ð"=>"O",
"Ð"=>"P",
"Ð "=>"R",
"С"=>"S",
"Т"=>"T",
"У"=>"U",
"Ф"=>"F",
"Ð¥"=>"H",
"Ц"=>"C",
"Ч"=>"Ch",
"Ш"=>"Sh",
"Щ"=>"Sht",
"Ъ"=>"U",
"Ь"=>"Io",
"Ю"=>"Iu",
"Я"=>"Ya"
);
/*-------------constructor----------*/
function MailClass(){
$this->Reciever = "put reciever here";
$this->Sender = "put sender here";
$this->Content = "text/html";
$this->Charset = "UTF-8";
$this->Encoding = "7bit";
}
function SendMail(){
$BCC = "";
if( strlen( $this->BCC ) )
{
$BCC = "\r\nBcc: ".$this->BCC;
}
return
mail($this->Reciever,
$this->Subject,
$this->Message,
"Content-Type: ".$this->Content.";
charset=\"".$this->Charset."\"\r\nContent-Transfer-Encoding:
".$this->Encoding."\r\nFrom: ".$this->Sender.$BCC
);
}
function SendAttachment(){
$Headers = "From: ".$this->Sender;
$SemiRand = md5( time() );
$mime_boundary = "==Multipart_Boundary_x{$SemiRand}x";
$Headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$this->Message .= "This is a multi-part message in MIME format.\n\n".
"--{$mime_boundary}\n".
"Content-Type: ".$this->Content.";
charset=\"".$this->Charset."\"\n".
"Content-Transfer-Encoding: ".$this->Encoding."\n\n".
$this->Message."\n\n";
$this->Attachment = chunk_split( base64_encode( $this->Attachment ) ) ;
$this->Message .= "--{$mime_boundary}\n" .
"Content-Type: {".$this->AttachmentType."};\n" .
" name=\"{".$this->AttachmentName."}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{".$this->AttachmentName."}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$this->Attachment . "\n\n" .
"--{$mime_boundary}--\n";
return
mail($this->Reciever,
$this->Subject,
$this->Message,
$Headers
);
}
function ToCyr($Text){
$cyrText = $Text;
foreach($this->Chars as $BG => $CYR)
$cyrText = str_replace($BG, $CYR, $cyrText);
return $cyrText;
}
}/*end class*/
?>
Now when this function is run in our website i get get errors. Any help developing a sendmail
function for running on windows?
----
Server IP: 64.71.164.2
Probable Submitter: 74.94.170.145
----
Manual Page -- http://www.php.net/manual/en/ref.mail.php
Edit -- https://master.php.net/note/edit/80581
Del: integrated -- https://master.php.net/note/delete/80581/integrated
Del: useless -- https://master.php.net/note/delete/80581/useless
Del: bad code -- https://master.php.net/note/delete/80581/bad+code
Del: spam -- https://master.php.net/note/delete/80581/spam
Del: non-english -- https://master.php.net/note/delete/80581/non-english
Del: in docs -- https://master.php.net/note/delete/80581/in+docs
Del: other reasons-- https://master.php.net/note/delete/80581
Reject -- https://master.php.net/note/reject/80581
Search -- https://master.php.net/manage/user-notes.php