Advertisement
fabi0

Untitled

Jun 7th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. public function htmlMail($html) {
  2.         // Уникално ид
  3.         $boundary = md5(uniqid(time()));
  4.        
  5.         // Хедъри
  6.         $this->header = "From: " . $this->fromName . ' <' . $this->fromEmail . ">" . "\r\n";
  7.         $this->header .= "To: " . $this->toEmail . "\r\n";
  8.         $this->header .= "Return-Path: " . $this->return . "\r\n";
  9.         $this->header .= "MIME-Version: 1.0\n";
  10.         $this->header .= 'Content-Type: multipart/alternative; boundary="' . $boundary . '"' . "\r\n";
  11.  
  12.         // Текст версия
  13.         $msgPlainText = "--" . $boundary . "\r\n";
  14.         $msgPlainText .= 'Content-Type: text/plain; charset="iso-8589-1"' . "\r\n";
  15.         $msgPlainText .= "Content-Transfer-Encoding: 8bit" . "\r\n";
  16.         $msgPlainText .= "If you are seeing this is because you may need to change your" . "\r\n";
  17.         $msgPlainText .= "preferred message format from HTML to plain text." . "\r\n" . "\r\n";
  18.  
  19.  
  20.         // HTML Версия
  21.         $msgHtml = "--" . $boundary . "\r\n";
  22.         $msgHtml .= 'Content-Type: text/html; charset="iso-8589-1"' . "\r\n";
  23.         $msgHtml .= "Content-Transfer-Encoding: 8bit" . "\r\n" . "\r\n";
  24.         $msgHtml .= $html;
  25.  
  26.         // Събиране
  27.         $message = $msgPlainText . $msgHtml . PHP_EOL;
  28.  
  29.         // Изпращане
  30.         $this->send($message);
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement