96 lines
1.7 KiB
PHP
96 lines
1.7 KiB
PHP
<?php
|
|
|
|
class MailAlt
|
|
{
|
|
public $mailer;
|
|
public $_notify;
|
|
public $encoding;
|
|
|
|
function __construct() {
|
|
$this->mailer = new PHPMailer();
|
|
$this->mailer->CharSet = 'UTF-8';
|
|
}
|
|
|
|
/**
|
|
* Установка отправителя
|
|
*/
|
|
function from($name)
|
|
{
|
|
$this->mailer->setFrom($name);
|
|
}
|
|
|
|
/**
|
|
* Установка получателя
|
|
*/
|
|
function to($name) // recipient
|
|
{
|
|
$this->mailer->addAddress($name);
|
|
}
|
|
|
|
function replyTo($name) // recipient
|
|
{
|
|
$this->mailer->AddReplyTo($name);
|
|
}
|
|
|
|
/**
|
|
* Установка получателей копии
|
|
*/
|
|
function copy($name) // recipient cc
|
|
{
|
|
$this->mailer->addCC($name);
|
|
}
|
|
|
|
function notify($notify)
|
|
{
|
|
$this->_notify = $notify;
|
|
}
|
|
|
|
/**
|
|
* Тема письма
|
|
*/
|
|
function subject(/*.string.*/$subject)
|
|
{
|
|
$this->mailer->Subject = $subject;
|
|
}
|
|
|
|
/**
|
|
* Текст письма
|
|
*/
|
|
function setContent($text)
|
|
{
|
|
$this->mailer->Body = $text;
|
|
}
|
|
|
|
function setType($text)
|
|
{
|
|
$this->mailer->isHTML($text == 'text/html');
|
|
}
|
|
|
|
/**
|
|
* Кодировка текста в письме
|
|
*/
|
|
function setEncoding($encoding)
|
|
{
|
|
$this->encoding = $encoding;
|
|
}
|
|
|
|
/**
|
|
* Добавление вложения из файла
|
|
*/
|
|
function addAttachment($filename, $name = null)
|
|
{
|
|
$this->mailer->addAttachment($filename, $name);
|
|
}
|
|
|
|
/**
|
|
* Отправка почты
|
|
*/
|
|
function send()
|
|
{
|
|
return $this->mailer->send();
|
|
}
|
|
|
|
function eml() {
|
|
return $this->mailer->getSentMIMEMessage();
|
|
}
|
|
}
|