mailer, some fixes, #16
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@142 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
33
mail/Mailer.php
Normal file
33
mail/Mailer.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link http://netmonsters.ru
|
||||
* @package Majestic
|
||||
* @subpackage mail
|
||||
* @since 2010-04-25
|
||||
* @version SVN: $Id$
|
||||
* @filesource $URL$
|
||||
*/
|
||||
|
||||
class Mailer
|
||||
{
|
||||
protected $headers;
|
||||
|
||||
public function __construct($host)
|
||||
{
|
||||
$this->headers .= 'From: noreply@' . $host . "\r\n";
|
||||
$this->headers .= 'Date: '. date('r') ."\r\n";
|
||||
$this->headers .= "Return-Path: noreply@". $host ."\r\n";
|
||||
$this->headers .= "X-Priority: 3 (Normal)\r\n";
|
||||
$this->headers .= "Message-ID: <". md5(uniqid(time()))."@". $host .">\r\n";
|
||||
$this->headers .= "MIME-Version: 1.0\r\n";
|
||||
$this->headers .= "Content-Type: text/plain; charset=utf-8\r\n";
|
||||
$this->headers .= "Content-Transfer-Encoding: 16bit\r\n";
|
||||
}
|
||||
|
||||
public function send($email, $subject, $message)
|
||||
{
|
||||
$subject = '=?UTF-8?B?' . base64_encode($subject) . "?=\r\n";
|
||||
return mail($email, $subject, $message, $this->headers);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user