Autor | Zpráva | ||
---|---|---|---|
Petr18 Profil |
#1 · Zasláno: 7. 6. 2011, 15:38:07 · Upravil/a: Petr18
Když odešlu mail, tak kódování platí pouze pro tělo zprávy a ne pro předmět, jak to udělat?
<?php class SMTPKlient { function SMTPKlient ($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; $this->PortSMTP = $SmtpPort; } function Odosli () { 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, "MIME-Version: 1.0\r\nContent-type:text/html; charset=utf-8\r\nTo: <".$this->to.">\r\nFrom: <".$this->from.">\r\nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n"); $talk["send"]=fgets($SMTPIN,256); //CLOSE CONNECTION AND EXIT ... fputs ($SMTPIN, "QUIT\r\n"); fclose($SMTPIN); // } return $talk; } } ?> |
||
Davex Profil |
#2 · Zasláno: 7. 6. 2011, 20:47:30
Pokud to chceš takto nízkoúrovňově, tak můžeš použít pro zakódování osmibitových znaků v MIME hlavičce kódování Base64 nebo Quoted-Printable podle RFC 2047 nebo podle PHP FAQ - kódování e-mailu.
|
||
Časová prodleva: 13 let
|
0