utf 8 - sand smtp mail php class SMTPClient -
i smtpclient class mail utf-8 post, did not anything! please me thank you
class smtpclient { function smtpclient ($smtpserver, $smtpport, $smtpuser, $smtppass, $from, $to, $subject, $body) { $this->smtpserver = $smtpserver; $this->smtpuser = base64_encode ($smtpuser); $this->smtppass = base64_encode ($smtppass); $this->from = $from; $this->to = $to; $this->subject = $subject; $this->body = $body; if ($smtpport == "") { $this->portsmtp = 25; }else{ $this->portsmtp = $smtpport; } } /////////////////////////////////////////////////////////////////////// $to = $_post['to']; $from =$_post['from']; $subject = $_post['sub']; $body = $_post['message']; $smtpmail = new smtpclient ($smtpserver, $smtpport, $smtpuser, $smtppass, $from, $to, $subject, $body); $smtpchat = $smtpmail->sendmail();
i found code here: http://url.lid.ir/kpyhfu
change defintion of sendmail method in smtpclient
function sendmail ($charset = "utf-8", $contenttype = "text/plain") { if ($smtpin = fsockopen ($this->smtpserver, $this->portsmtp)) { fputs ($smtpin, "ehlo ".$http_host."\r\n"); $talk["hello"] = fgets ( $smtpin, 1024 ); fputs($smtpin, "auth login\r\n"); $talk["res"]=fgets($smtpin,1024); fputs($smtpin, $this->smtpuser."\r\n"); $talk["user"]=fgets($smtpin,1024); fputs($smtpin, $this->smtppass."\r\n"); $talk["pass"]=fgets($smtpin,256); fputs ($smtpin, "mail from: <".$this->from.">\r\n"); $talk["from"] = fgets ( $smtpin, 1024 ); fputs ($smtpin, "rcpt to: <".$this->to.">\r\n"); $talk["to"] = fgets ($smtpin, 1024); fputs($smtpin, "data\r\n"); $talk["data"]=fgets( $smtpin,1024 ); fputs($smtpin, "to: <".$this->to.">\r\nfrom: <".$this->from.">\r\nsubject:".$this->subject."\r\n". "content-type: ".$contenttype."; ".$charset."\r\n\r\n".$this->body."\r\n.\r\n"); $talk["send"]=fgets($smtpin,256); //close connection , exit ... fputs ($smtpin, "quit\r\n"); fclose($smtpin); } return $talk; }
Comments
Post a Comment