note 80581 added to ref.mail

From: 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

« previous php.notes (#135334) next »